mirror of https://github.com/proxmox/mirror_qemu
pc: Unbreak ROM mapping for ISA machine
This is based on the original fix by Hervé Poussineau: pc_memory_init actually takes a memory region for mapping BIOS and extension ROMs. That equals the PCI memory region if PCI is available, but must be system memory in the ISA case. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>master
parent
dd8e93799f
commit
4463aee630
8
hw/pc.c
8
hw/pc.c
|
@ -965,7 +965,7 @@ void pc_memory_init(MemoryRegion *system_memory,
|
||||||
const char *initrd_filename,
|
const char *initrd_filename,
|
||||||
ram_addr_t below_4g_mem_size,
|
ram_addr_t below_4g_mem_size,
|
||||||
ram_addr_t above_4g_mem_size,
|
ram_addr_t above_4g_mem_size,
|
||||||
MemoryRegion *pci_memory,
|
MemoryRegion *rom_memory,
|
||||||
MemoryRegion **ram_memory)
|
MemoryRegion **ram_memory)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
@ -1029,7 +1029,7 @@ void pc_memory_init(MemoryRegion *system_memory,
|
||||||
isa_bios = g_malloc(sizeof(*isa_bios));
|
isa_bios = g_malloc(sizeof(*isa_bios));
|
||||||
memory_region_init_alias(isa_bios, "isa-bios", bios,
|
memory_region_init_alias(isa_bios, "isa-bios", bios,
|
||||||
bios_size - isa_bios_size, isa_bios_size);
|
bios_size - isa_bios_size, isa_bios_size);
|
||||||
memory_region_add_subregion_overlap(pci_memory,
|
memory_region_add_subregion_overlap(rom_memory,
|
||||||
0x100000 - isa_bios_size,
|
0x100000 - isa_bios_size,
|
||||||
isa_bios,
|
isa_bios,
|
||||||
1);
|
1);
|
||||||
|
@ -1037,13 +1037,13 @@ void pc_memory_init(MemoryRegion *system_memory,
|
||||||
|
|
||||||
option_rom_mr = g_malloc(sizeof(*option_rom_mr));
|
option_rom_mr = g_malloc(sizeof(*option_rom_mr));
|
||||||
memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE);
|
memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE);
|
||||||
memory_region_add_subregion_overlap(pci_memory,
|
memory_region_add_subregion_overlap(rom_memory,
|
||||||
PC_ROM_MIN_VGA,
|
PC_ROM_MIN_VGA,
|
||||||
option_rom_mr,
|
option_rom_mr,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
/* map all the bios at the top of memory */
|
/* map all the bios at the top of memory */
|
||||||
memory_region_add_subregion(pci_memory,
|
memory_region_add_subregion(rom_memory,
|
||||||
(uint32_t)(-bios_size),
|
(uint32_t)(-bios_size),
|
||||||
bios);
|
bios);
|
||||||
|
|
||||||
|
|
2
hw/pc.h
2
hw/pc.h
|
@ -137,7 +137,7 @@ void pc_memory_init(MemoryRegion *system_memory,
|
||||||
const char *initrd_filename,
|
const char *initrd_filename,
|
||||||
ram_addr_t below_4g_mem_size,
|
ram_addr_t below_4g_mem_size,
|
||||||
ram_addr_t above_4g_mem_size,
|
ram_addr_t above_4g_mem_size,
|
||||||
MemoryRegion *pci_memory,
|
MemoryRegion *rom_memory,
|
||||||
MemoryRegion **ram_memory);
|
MemoryRegion **ram_memory);
|
||||||
qemu_irq *pc_allocate_cpu_irq(void);
|
qemu_irq *pc_allocate_cpu_irq(void);
|
||||||
void pc_vga_init(PCIBus *pci_bus);
|
void pc_vga_init(PCIBus *pci_bus);
|
||||||
|
|
13
hw/pc_piix.c
13
hw/pc_piix.c
|
@ -97,6 +97,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||||
ISADevice *rtc_state;
|
ISADevice *rtc_state;
|
||||||
MemoryRegion *ram_memory;
|
MemoryRegion *ram_memory;
|
||||||
MemoryRegion *pci_memory;
|
MemoryRegion *pci_memory;
|
||||||
|
MemoryRegion *rom_memory;
|
||||||
|
|
||||||
pc_cpus_init(cpu_model);
|
pc_cpus_init(cpu_model);
|
||||||
|
|
||||||
|
@ -112,15 +113,21 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||||
below_4g_mem_size = ram_size;
|
below_4g_mem_size = ram_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_memory = g_new(MemoryRegion, 1);
|
if (pci_enabled) {
|
||||||
memory_region_init(pci_memory, "pci", INT64_MAX);
|
pci_memory = g_new(MemoryRegion, 1);
|
||||||
|
memory_region_init(pci_memory, "pci", INT64_MAX);
|
||||||
|
rom_memory = pci_memory;
|
||||||
|
} else {
|
||||||
|
pci_memory = NULL;
|
||||||
|
rom_memory = system_memory;
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate ram and load rom/bios */
|
/* allocate ram and load rom/bios */
|
||||||
if (!xen_enabled()) {
|
if (!xen_enabled()) {
|
||||||
pc_memory_init(system_memory,
|
pc_memory_init(system_memory,
|
||||||
kernel_filename, kernel_cmdline, initrd_filename,
|
kernel_filename, kernel_cmdline, initrd_filename,
|
||||||
below_4g_mem_size, above_4g_mem_size,
|
below_4g_mem_size, above_4g_mem_size,
|
||||||
pci_memory, &ram_memory);
|
rom_memory, &ram_memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xen_enabled()) {
|
if (!xen_enabled()) {
|
||||||
|
|
Loading…
Reference in New Issue