diff mbox

[Qemu] Allow booting large Coreboot image as BIOS

Message ID AANLkTinOeAtW5GB7wEC96AZ0q5vb1ixoOPyxrJSQotlR@mail.gmail.com
State New
Headers show

Commit Message

Ed Swierk May 19, 2010, 6:45 a.m. UTC
When I build a 1024-kB Coreboot image (emulation/qemu-x86 mainboard),
qemu goes into a loop, resetting just after the "Jumping to boot code"
message.  This can be avoided by removing the "| IO_MEM_ROM" from the
call to cpu_register_physical_memory(0x100000 - isa_bios_size, ...)
call in pc_memory_init().

The next problem I hit is the complaint "ERROR: No valid CBFS header
found!  Maybe the ROM isn't entirely mapped yet?".  I can work around
this by allocating a separate chunk of RAM for the top 128 kB of the
BIOS image in ISA space and copying it rather than mapping it from the
full ROM image.

Both of these changes are the result of random hacking rather than any
real understanding of the issues involved.  I'd appreciate any better
ideas.

Signed-off-by: Ed Swierk <eswierk@aristanetworks.com>
---
 hw/pc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 20dc7fd..88478e7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -880,7 +880,10 @@  void pc_memory_init(ram_addr_t ram_size,
         isa_bios_size = 128 * 1024;
     cpu_register_physical_memory(0x100000 - isa_bios_size,
                                  isa_bios_size,
-                                 (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
+                                 qemu_ram_alloc(isa_bios_size));
+    cpu_physical_memory_write_rom(0x100000 - isa_bios_size,
+                                  qemu_get_ram_ptr(bios_offset + bios_size - isa_bios_size),
+                                  isa_bios_size);
 
     option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE);
     cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset);