Commit b01cde7bdf81d7bf1ea31b2ff100ddcc8880c068
1 parent
60237223
ETRAX-FS board: Add more flash and internal memory. Select interrupt nr for the
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4302 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
37 additions
and
21 deletions
hw/etraxfs.c
... | ... | @@ -38,7 +38,11 @@ static void main_cpu_reset(void *opaque) |
38 | 38 | extern qemu_irq *etraxfs_pic_init(CPUState *env, target_phys_addr_t base); |
39 | 39 | void etraxfs_timer_init(CPUState *env, qemu_irq *irqs, |
40 | 40 | target_phys_addr_t base); |
41 | -void etraxfs_ser_init(CPUState *env, qemu_irq *irqs, target_phys_addr_t base); | |
41 | +void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr, | |
42 | + target_phys_addr_t base); | |
43 | + | |
44 | +#define FLASH_SIZE 0x2000000 | |
45 | +#define INTMEM_SIZE (128 * 1024) | |
42 | 46 | |
43 | 47 | static |
44 | 48 | 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, |
49 | 53 | CPUState *env; |
50 | 54 | qemu_irq *pic; |
51 | 55 | int kernel_size; |
52 | - int flash_size = 0x800000; | |
53 | 56 | int index; |
54 | - ram_addr_t phys_flash; | |
55 | 57 | ram_addr_t phys_ram; |
58 | + ram_addr_t phys_intmem; | |
56 | 59 | |
57 | 60 | /* init CPUs */ |
58 | 61 | if (cpu_model == NULL) { |
... | ... | @@ -68,36 +71,49 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, |
68 | 71 | /* Unached mapping. */ |
69 | 72 | cpu_register_physical_memory(0xc0000000, ram_size, phys_ram | IO_MEM_RAM); |
70 | 73 | |
71 | - phys_flash = qemu_ram_alloc(flash_size); | |
72 | - cpu_register_physical_memory(0,flash_size, IO_MEM_ROM); | |
73 | - cpu_register_physical_memory(0x80000000, flash_size, IO_MEM_ROM); | |
74 | - cpu_register_physical_memory(0x04000000, flash_size, IO_MEM_ROM); | |
75 | - cpu_register_physical_memory(0x84000000, flash_size, | |
74 | + /* The ETRAX-FS has 128Kb on chip ram, the docs refer to it as the | |
75 | + internal memory. Cached and uncached mappings. */ | |
76 | + phys_intmem = qemu_ram_alloc(INTMEM_SIZE); | |
77 | + cpu_register_physical_memory(0xb8000000, INTMEM_SIZE, | |
78 | + phys_intmem | IO_MEM_RAM); | |
79 | + cpu_register_physical_memory(0x38000000, INTMEM_SIZE, | |
80 | + phys_intmem | IO_MEM_RAM); | |
81 | + | |
82 | + cpu_register_physical_memory(0, FLASH_SIZE, IO_MEM_ROM); | |
83 | + cpu_register_physical_memory(0x80000000, FLASH_SIZE, IO_MEM_ROM); | |
84 | + cpu_register_physical_memory(0x04000000, FLASH_SIZE, IO_MEM_ROM); | |
85 | + cpu_register_physical_memory(0x84000000, FLASH_SIZE, | |
76 | 86 | 0x04000000 | IO_MEM_ROM); |
77 | 87 | index = drive_get_index(IF_PFLASH, 0, 0); |
78 | - pflash_cfi01_register(0x80000000, flash_size, | |
79 | - drives_table[index].bdrv, 65536, flash_size >> 16, | |
80 | - 4, 0x0000, 0x0000, 0x0000, 0x0000); | |
81 | - index = drive_get_index(IF_PFLASH, 0, 1); | |
82 | - pflash_cfi01_register(0x84000000, flash_size, | |
83 | - drives_table[index].bdrv, 65536, flash_size >> 16, | |
88 | + pflash_cfi01_register(0x80000000, FLASH_SIZE, | |
89 | + drives_table[index].bdrv, 65536, FLASH_SIZE >> 16, | |
84 | 90 | 4, 0x0000, 0x0000, 0x0000, 0x0000); |
85 | 91 | |
86 | 92 | pic = etraxfs_pic_init(env, 0xb001c000); |
87 | 93 | /* 2 timers. */ |
88 | - etraxfs_timer_init(env, pic, 0xb001e000); | |
89 | - etraxfs_timer_init(env, pic, 0xb005e000); | |
94 | + etraxfs_timer_init(env, pic + 26, 0xb001e000); | |
95 | + etraxfs_timer_init(env, pic + 26, 0xb005e000); | |
90 | 96 | /* 4 serial ports. */ |
91 | - etraxfs_ser_init(env, pic, 0xb0026000); | |
92 | - etraxfs_ser_init(env, pic, 0xb0028000); | |
93 | - etraxfs_ser_init(env, pic, 0xb002a000); | |
94 | - etraxfs_ser_init(env, pic, 0xb002c000); | |
97 | + etraxfs_ser_init(env, pic + 19, serial_hds[0], 0xb0026000); | |
98 | + if (serial_hds[1]) | |
99 | + etraxfs_ser_init(env, pic + 20, serial_hds[1], 0xb0028000); | |
100 | + if (serial_hds[2]) | |
101 | + etraxfs_ser_init(env, pic + 21, serial_hds[2], 0xb002a000); | |
102 | + if (serial_hds[3]) | |
103 | + etraxfs_ser_init(env, pic + 22, serial_hds[3], 0xb002c000); | |
95 | 104 | |
105 | +#if 1 | |
106 | + /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis devboard | |
107 | + SDK. */ | |
108 | + kernel_size = load_elf(kernel_filename, 0, &env->pc, NULL, NULL); | |
109 | +#else | |
110 | + /* Takes a kimage from the axis devboard SDK. */ | |
96 | 111 | kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000); |
112 | + env->pc = 0x40004000; | |
113 | +#endif | |
97 | 114 | /* magic for boot. */ |
98 | 115 | env->regs[8] = 0x56902387; |
99 | 116 | env->regs[9] = 0x40004000 + kernel_size; |
100 | - env->pc = 0x40004000; | |
101 | 117 | |
102 | 118 | { |
103 | 119 | unsigned char *ptr = phys_ram_base + 0x4000; | ... | ... |