diff options
Diffstat (limited to 'hw/mainstone.c')
-rw-r--r-- | hw/mainstone.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/hw/mainstone.c b/hw/mainstone.c index 13f72b3504..354015202f 100644 --- a/hw/mainstone.c +++ b/hw/mainstone.c @@ -29,6 +29,7 @@ static void mainstone_common_init(int ram_size, int vga_ram_size, uint32_t mainstone_rom = 0x00800000; struct pxa2xx_state_s *cpu; qemu_irq *mst_irq; + int index; if (!cpu_model) cpu_model = "pxa270-c5"; @@ -47,18 +48,32 @@ static void mainstone_common_init(int ram_size, int vga_ram_size, /* Setup initial (reset) machine state */ cpu->env->regs[15] = PXA2XX_SDRAM_BASE; - /* There are two 32MiB flash devices on the board */ - if (!pflash_register(MST_FLASH_0, mainstone_ram + PXA2XX_INTERNAL_SIZE, - pflash_table[0], 256 * 1024, 128, 4, 0, 0, 0, 0)) { - fprintf(stderr, "qemu: Error register flash memory.\n"); - exit(1); - } + /* There are two 32MiB flash devices on the board */ + index = drive_get_index(IF_PFLASH, 0, 0); + if (index == -1) { + fprintf(stderr, "Two flash images must be given with the " + "'pflash' parameter\n"); + exit(1); + } + if (!pflash_register(MST_FLASH_0, mainstone_ram + PXA2XX_INTERNAL_SIZE, + drives_table[index].bdrv, + 256 * 1024, 128, 4, 0, 0, 0, 0)) { + fprintf(stderr, "qemu: Error registering flash memory.\n"); + exit(1); + } - if (!pflash_register(MST_FLASH_1, mainstone_ram + PXA2XX_INTERNAL_SIZE, - pflash_table[1], 256 * 1024, 128, 4, 0, 0, 0, 0)) { - fprintf(stderr, "qemu: Error register flash memory.\n"); - exit(1); - } + index = drive_get_index(IF_PFLASH, 0, 1); + if (index == -1) { + fprintf(stderr, "Two flash images must be given with the " + "'pflash' parameter\n"); + exit(1); + } + if (!pflash_register(MST_FLASH_1, mainstone_ram + PXA2XX_INTERNAL_SIZE, + drives_table[index].bdrv, + 256 * 1024, 128, 4, 0, 0, 0, 0)) { + fprintf(stderr, "qemu: Error registering flash memory.\n"); + exit(1); + } mst_irq = mst_irq_init(cpu, MST_FPGA_PHYS, PXA2XX_PIC_GPIO_0); smc91c111_init(&nd_table[0], MST_ETH_PHYS, mst_irq[ETHERNET_IRQ]); |