mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/i386/pc: move shared x86 functions to x86.c and export them
Move x86 functions that will be shared between PC and non-PC machine types to x86.c, along with their helpers. Signed-off-by: Sergio Lopez <slp@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
86a9a7916b
commit
549e984e67
@@ -1,5 +1,6 @@
|
||||
obj-$(CONFIG_KVM) += kvm/
|
||||
obj-y += e820_memory_layout.o multiboot.o
|
||||
obj-y += x86.o
|
||||
obj-y += pc.o
|
||||
obj-$(CONFIG_I440FX) += pc_piix.o
|
||||
obj-$(CONFIG_Q35) += pc_q35.o
|
||||
|
||||
+1
-586
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "qemu/units.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/i386/x86.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/i386/apic.h"
|
||||
#include "hw/display/ramfb.h"
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "hw/pci-host/q35.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/i386/x86.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/i386/ich9.h"
|
||||
#include "hw/i386/amd_iommu.h"
|
||||
|
||||
+1
-55
@@ -31,6 +31,7 @@
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/units.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/i386/x86.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
@@ -38,8 +39,6 @@
|
||||
#include "hw/block/flash.h"
|
||||
#include "sysemu/kvm.h"
|
||||
|
||||
#define BIOS_FILENAME "bios.bin"
|
||||
|
||||
/*
|
||||
* We don't have a theoretically justifiable exact lower bound on the base
|
||||
* address of any flash mapping. In practice, the IO-APIC MMIO range is
|
||||
@@ -211,59 +210,6 @@ static void pc_system_flash_map(PCMachineState *pcms,
|
||||
}
|
||||
}
|
||||
|
||||
static void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
|
||||
{
|
||||
char *filename;
|
||||
MemoryRegion *bios, *isa_bios;
|
||||
int bios_size, isa_bios_size;
|
||||
int ret;
|
||||
|
||||
/* BIOS load */
|
||||
if (bios_name == NULL) {
|
||||
bios_name = BIOS_FILENAME;
|
||||
}
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||
if (filename) {
|
||||
bios_size = get_image_size(filename);
|
||||
} else {
|
||||
bios_size = -1;
|
||||
}
|
||||
if (bios_size <= 0 ||
|
||||
(bios_size % 65536) != 0) {
|
||||
goto bios_error;
|
||||
}
|
||||
bios = g_malloc(sizeof(*bios));
|
||||
memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
|
||||
if (!isapc_ram_fw) {
|
||||
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);
|
||||
}
|
||||
g_free(filename);
|
||||
|
||||
/* map the last 128KB of the BIOS in ISA space */
|
||||
isa_bios_size = MIN(bios_size, 128 * KiB);
|
||||
isa_bios = g_malloc(sizeof(*isa_bios));
|
||||
memory_region_init_alias(isa_bios, NULL, "isa-bios", bios,
|
||||
bios_size - isa_bios_size, isa_bios_size);
|
||||
memory_region_add_subregion_overlap(rom_memory,
|
||||
0x100000 - isa_bios_size,
|
||||
isa_bios,
|
||||
1);
|
||||
if (!isapc_ram_fw) {
|
||||
memory_region_set_readonly(isa_bios, true);
|
||||
}
|
||||
|
||||
/* map all the bios at the top of memory */
|
||||
memory_region_add_subregion(rom_memory,
|
||||
(uint32_t)(-bios_size),
|
||||
bios);
|
||||
}
|
||||
|
||||
void pc_system_firmware_init(PCMachineState *pcms,
|
||||
MemoryRegion *rom_memory)
|
||||
{
|
||||
|
||||
+690
File diff suppressed because it is too large
Load Diff
@@ -198,7 +198,6 @@ bool pc_machine_is_smm_enabled(PCMachineState *pcms);
|
||||
void pc_register_ferr_irq(qemu_irq irq);
|
||||
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
|
||||
|
||||
void x86_cpus_init(PCMachineState *pcms);
|
||||
void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp);
|
||||
void pc_smp_parse(MachineState *ms, QemuOpts *opts);
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2 or later, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef HW_I386_X86_H
|
||||
#define HW_I386_X86_H
|
||||
|
||||
#include "hw/boards.h"
|
||||
|
||||
uint32_t x86_cpu_apic_id_from_index(PCMachineState *pcms,
|
||||
unsigned int cpu_index);
|
||||
void x86_cpu_new(PCMachineState *pcms, int64_t apic_id, Error **errp);
|
||||
void x86_cpus_init(PCMachineState *pcms);
|
||||
CpuInstanceProperties x86_cpu_index_to_props(MachineState *ms,
|
||||
unsigned cpu_index);
|
||||
int64_t x86_get_default_cpu_node_id(const MachineState *ms, int idx);
|
||||
const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms);
|
||||
|
||||
void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw);
|
||||
|
||||
void x86_load_linux(PCMachineState *x86ms, FWCfgState *fw_cfg);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user