aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-06 17:19:24 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-06 17:19:24 +0000
commit070ce5edc39df04ffed2b002da27e69859ee01b7 (patch)
treeebf52d8eaf138c3f20467ec998196af6bc04e0a9
parentacdf72bbaca6be56765a92122b17a7ce201d5f68 (diff)
Make the Malta bootloader handling a bit more transparent.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2949 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/mips_malta.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 21eb75faf7..f113e5611d 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -778,9 +778,23 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
cpu_register_physical_memory(0x1fc00000LL,
BIOS_SIZE, bios_offset | IO_MEM_ROM);
- /* Load a BIOS image except if a kernel image has been specified. In
- the later case, just write a small bootloader to the flash
- location. */
+ /* FPGA */
+ malta_fpga = malta_fpga_init(0x1f000000LL, env);
+
+ /* Load a BIOS image unless a kernel image has been specified. */
+ if (!kernel_filename) {
+ snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
+ ret = load_image(buf, phys_ram_base + bios_offset);
+ if (ret < 0 || ret > BIOS_SIZE) {
+ fprintf(stderr,
+ "qemu: Could not load MIPS bios '%s', and no -kernel argument was specified\n",
+ buf);
+ exit(1);
+ }
+ }
+
+ /* If a kernel image has been specified, write a small bootloader
+ to the flash location. */
if (kernel_filename) {
env->ram_size = ram_size;
env->kernel_filename = kernel_filename;
@@ -789,14 +803,6 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
kernel_entry = load_kernel(env);
env->CP0_Status &= ~((1 << CP0St_BEV) | (1 << CP0St_ERL));
write_bootloader(env, bios_offset, kernel_entry);
- } else {
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
- ret = load_image(buf, phys_ram_base + bios_offset);
- if (ret < 0 || ret > BIOS_SIZE) {
- fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n",
- buf);
- exit(1);
- }
}
/* Board ID = 0x420 (Malta Board with CoreLV)
@@ -809,9 +815,6 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
cpu_mips_clock_init(env);
cpu_mips_irqctrl_init();
- /* FPGA */
- malta_fpga = malta_fpga_init(0x1f000000LL, env);
-
/* Interrupt controller */
/* The 8259 is attached to the MIPS CPU INT0 pin, ie interrupt 2 */
i8259 = i8259_init(env->irq[2]);