Index: qemu/hw/gumstix.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ qemu/hw/gumstix.c 2006-11-22 12:25:26.000000000 +0800 @@ -0,0 +1,95 @@ +/* + * Gumstix platform emulation based on Intel XScale PXA255 + * + * Copyright (c) 2006 Thorsten Zitterell + * + * This code is licenced under the GPL. +*/ + +#include "vl.h" +#include "pxa255_pic.h" +#include "pxa255_gpio.h" +#include "pxa255_dma.h" +#include "pxa255_timer.h" + + +static int serial_io[4] = { 0x40100000, 0x40200000, 0x40700000,0x41600000 }; +static int serial_irq[4] = { 22, 21, 20, 7 }; + + +/* Board init. */ + +static void gumstix_init(int ram_size, int vga_ram_size, int boot_device, + DisplayState *ds, const char **fd_filename, int snapshot, + const char *kernel_filename, const char *kernel_cmdline, + const char *initrd_filename, uint32_t cpuid) +{ + int i; + CPUState *env; + pxa255_pic_state *pic; + pxa255_gpio_info *gpio; + + env = cpu_init(); + cpu_arm_set_model(env, cpuid); + env->cp15.c1_sys |= (1 << 13); + + if (bs_table[0] == NULL) { + fprintf(stderr, "A flash image must be given with the 'hda' parameter\n"); + exit(1); + } + + ram_size = 80 * 1024 * 1024; + printf("Changing RAM size to %i MB\n",ram_size/(1 << 20)); + + if (!pflash_register(0x00000000, 0x0, bs_table[0], 128*1024, 128, 2, 0, 0, 0, 0)) { + fprintf(stderr, "qemu: Error register flash memory.\n"); + exit(1); + } + + cpu_register_physical_memory(0xa0000000, ram_size - 128*128*1024, 128*128*1024); + + env->regs[15] = 0x00000000; + + pic = pxa255_pic_init(0x40d00000, env, PXA255_PIC_CPU_IRQ, PXA255_PIC_CPU_FIQ); + + pxa255_timer_init(0x40a00000, pic, 26, env); + pxa255_dma_init(0x40000000, pic, 18); + + gpio = pxa255_gpio_init(0x40e00000, pic, 10); + + for(i = 0; i < 4; i++) { + if (serial_hds[i]) { + serial_mm_init(&pxa255_pic_set_irq, pic, + serial_io[i], 2, serial_irq[i], serial_hds[i]); + } + } + + /* pxa255_gpio triggers an interrupt when an low-high edge is detected on line 36 */ + if (nd_table[0].vlan) { + if (nd_table[0].model == NULL + || strcmp(nd_table[0].model, "smc91c111") == 0) { + smc91c111_init(&pxa255_set_gpio, &nd_table[0], 0x04000300, gpio, 36); + } else { + fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); + exit (1); + } + } + +} + +static void gumstix_common_init(int ram_size, int vga_ram_size, + int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, + const char *kernel_filename, const char *kernel_cmdline, + const char *initrd_filename) +{ + + gumstix_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, + snapshot, kernel_filename, kernel_cmdline, + initrd_filename, ARM_CPUID_PXA255); +} + +QEMUMachine gumstix_machine = { + "gumstix", + "PXA255 Gumstix", + gumstix_common_init, +}; Index: qemu/vl.h =================================================================== --- qemu.orig/vl.h 2006-11-22 12:23:53.000000000 +0800 +++ qemu/vl.h 2006-11-22 12:25:26.000000000 +0800 @@ -1235,6 +1235,9 @@ /* realview.c */ extern QEMUMachine realview_machine; +/* gumstix.c */ +extern QEMUMachine gumstix_machine; + /* ps2.c */ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); Index: qemu/Makefile.target =================================================================== --- qemu.orig/Makefile.target 2006-11-22 12:24:24.000000000 +0800 +++ qemu/Makefile.target 2006-11-22 12:25:52.000000000 +0800 @@ -378,6 +378,7 @@ VL_OBJS+= versatile_pci.o VL_OBJS+= pxa255_pic.o pxa255_gpio.o pxa255_timer.o pxa255_dma.o VL_OBJS+= pflash_cfi01.o +VL_OBJS+= serial.o gumstix.o VL_OBJS+= arm_gic.o realview.o arm_sysctl.o endif ifeq ($(TARGET_BASE_ARCH), sh4)