Commit 070ce5edc39df04ffed2b002da27e69859ee01b7

Authored by ths
1 parent acdf72bb

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
Showing 1 changed file with 17 additions and 14 deletions
hw/mips_malta.c
... ... @@ -778,9 +778,23 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
778 778 cpu_register_physical_memory(0x1fc00000LL,
779 779 BIOS_SIZE, bios_offset | IO_MEM_ROM);
780 780  
781   - /* Load a BIOS image except if a kernel image has been specified. In
782   - the later case, just write a small bootloader to the flash
783   - location. */
  781 + /* FPGA */
  782 + malta_fpga = malta_fpga_init(0x1f000000LL, env);
  783 +
  784 + /* Load a BIOS image unless a kernel image has been specified. */
  785 + if (!kernel_filename) {
  786 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  787 + ret = load_image(buf, phys_ram_base + bios_offset);
  788 + if (ret < 0 || ret > BIOS_SIZE) {
  789 + fprintf(stderr,
  790 + "qemu: Could not load MIPS bios '%s', and no -kernel argument was specified\n",
  791 + buf);
  792 + exit(1);
  793 + }
  794 + }
  795 +
  796 + /* If a kernel image has been specified, write a small bootloader
  797 + to the flash location. */
784 798 if (kernel_filename) {
785 799 env->ram_size = ram_size;
786 800 env->kernel_filename = kernel_filename;
... ... @@ -789,14 +803,6 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
789 803 kernel_entry = load_kernel(env);
790 804 env->CP0_Status &= ~((1 << CP0St_BEV) | (1 << CP0St_ERL));
791 805 write_bootloader(env, bios_offset, kernel_entry);
792   - } else {
793   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
794   - ret = load_image(buf, phys_ram_base + bios_offset);
795   - if (ret < 0 || ret > BIOS_SIZE) {
796   - fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n",
797   - buf);
798   - exit(1);
799   - }
800 806 }
801 807  
802 808 /* 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,
809 815 cpu_mips_clock_init(env);
810 816 cpu_mips_irqctrl_init();
811 817  
812   - /* FPGA */
813   - malta_fpga = malta_fpga_init(0x1f000000LL, env);
814   -
815 818 /* Interrupt controller */
816 819 /* The 8259 is attached to the MIPS CPU INT0 pin, ie interrupt 2 */
817 820 i8259 = i8259_init(env->irq[2]);
... ...