diff options
Diffstat (limited to 'hw/etraxfs.c')
-rw-r--r-- | hw/etraxfs.c | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/hw/etraxfs.c b/hw/etraxfs.c index eb1625833e..a95115da13 100644 --- a/hw/etraxfs.c +++ b/hw/etraxfs.c @@ -38,7 +38,11 @@ static void main_cpu_reset(void *opaque) extern qemu_irq *etraxfs_pic_init(CPUState *env, target_phys_addr_t base); void etraxfs_timer_init(CPUState *env, qemu_irq *irqs, target_phys_addr_t base); -void etraxfs_ser_init(CPUState *env, qemu_irq *irqs, target_phys_addr_t base); +void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr, + target_phys_addr_t base); + +#define FLASH_SIZE 0x2000000 +#define INTMEM_SIZE (128 * 1024) static void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, @@ -49,10 +53,9 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, CPUState *env; qemu_irq *pic; int kernel_size; - int flash_size = 0x800000; int index; - ram_addr_t phys_flash; ram_addr_t phys_ram; + ram_addr_t phys_intmem; /* init CPUs */ if (cpu_model == NULL) { @@ -68,36 +71,49 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, /* Unached mapping. */ cpu_register_physical_memory(0xc0000000, ram_size, phys_ram | IO_MEM_RAM); - phys_flash = qemu_ram_alloc(flash_size); - cpu_register_physical_memory(0,flash_size, IO_MEM_ROM); - cpu_register_physical_memory(0x80000000, flash_size, IO_MEM_ROM); - cpu_register_physical_memory(0x04000000, flash_size, IO_MEM_ROM); - cpu_register_physical_memory(0x84000000, flash_size, + /* The ETRAX-FS has 128Kb on chip ram, the docs refer to it as the + internal memory. Cached and uncached mappings. */ + phys_intmem = qemu_ram_alloc(INTMEM_SIZE); + cpu_register_physical_memory(0xb8000000, INTMEM_SIZE, + phys_intmem | IO_MEM_RAM); + cpu_register_physical_memory(0x38000000, INTMEM_SIZE, + phys_intmem | IO_MEM_RAM); + + cpu_register_physical_memory(0, FLASH_SIZE, IO_MEM_ROM); + cpu_register_physical_memory(0x80000000, FLASH_SIZE, IO_MEM_ROM); + cpu_register_physical_memory(0x04000000, FLASH_SIZE, IO_MEM_ROM); + cpu_register_physical_memory(0x84000000, FLASH_SIZE, 0x04000000 | IO_MEM_ROM); index = drive_get_index(IF_PFLASH, 0, 0); - pflash_cfi01_register(0x80000000, flash_size, - drives_table[index].bdrv, 65536, flash_size >> 16, - 4, 0x0000, 0x0000, 0x0000, 0x0000); - index = drive_get_index(IF_PFLASH, 0, 1); - pflash_cfi01_register(0x84000000, flash_size, - drives_table[index].bdrv, 65536, flash_size >> 16, + pflash_cfi01_register(0x80000000, FLASH_SIZE, + drives_table[index].bdrv, 65536, FLASH_SIZE >> 16, 4, 0x0000, 0x0000, 0x0000, 0x0000); pic = etraxfs_pic_init(env, 0xb001c000); /* 2 timers. */ - etraxfs_timer_init(env, pic, 0xb001e000); - etraxfs_timer_init(env, pic, 0xb005e000); + etraxfs_timer_init(env, pic + 26, 0xb001e000); + etraxfs_timer_init(env, pic + 26, 0xb005e000); /* 4 serial ports. */ - etraxfs_ser_init(env, pic, 0xb0026000); - etraxfs_ser_init(env, pic, 0xb0028000); - etraxfs_ser_init(env, pic, 0xb002a000); - etraxfs_ser_init(env, pic, 0xb002c000); + etraxfs_ser_init(env, pic + 19, serial_hds[0], 0xb0026000); + if (serial_hds[1]) + etraxfs_ser_init(env, pic + 20, serial_hds[1], 0xb0028000); + if (serial_hds[2]) + etraxfs_ser_init(env, pic + 21, serial_hds[2], 0xb002a000); + if (serial_hds[3]) + etraxfs_ser_init(env, pic + 22, serial_hds[3], 0xb002c000); +#if 1 + /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis devboard + SDK. */ + kernel_size = load_elf(kernel_filename, 0, &env->pc, NULL, NULL); +#else + /* Takes a kimage from the axis devboard SDK. */ kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000); + env->pc = 0x40004000; +#endif /* magic for boot. */ env->regs[8] = 0x56902387; env->regs[9] = 0x40004000 + kernel_size; - env->pc = 0x40004000; { unsigned char *ptr = phys_ram_base + 0x4000; |