Commit fa1bdde4a3db4b0bc21b7ae1a3c8af5678c31dcc
1 parent
96768ff7
ETRAX machine updates.
* Move DMA_run into the dma controller to allow for multiple ETRAX/CRIS machines. * Support both ELF and kimage kernel images. * Correct emulation of the DMA RW_DATA register. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4678 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
23 additions
and
17 deletions
hw/etraxfs.c
... | ... | @@ -44,7 +44,6 @@ void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr, |
44 | 44 | #define FLASH_SIZE 0x2000000 |
45 | 45 | #define INTMEM_SIZE (128 * 1024) |
46 | 46 | |
47 | -static void *etraxfs_dmac; | |
48 | 47 | static uint32_t bootstrap_pc; |
49 | 48 | |
50 | 49 | static void main_cpu_reset(void *opaque) |
... | ... | @@ -64,6 +63,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, |
64 | 63 | { |
65 | 64 | CPUState *env; |
66 | 65 | qemu_irq *pic; |
66 | + void *etraxfs_dmac; | |
67 | 67 | struct etraxfs_dma_client *eth[2] = {NULL, NULL}; |
68 | 68 | int kernel_size; |
69 | 69 | int i; |
... | ... | @@ -138,19 +138,20 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, |
138 | 138 | } |
139 | 139 | |
140 | 140 | if (kernel_filename) { |
141 | -#if 1 | |
141 | + uint64_t entry; | |
142 | 142 | /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis |
143 | 143 | devboard SDK. */ |
144 | 144 | kernel_size = load_elf(kernel_filename, 0, |
145 | - &bootstrap_pc, NULL, NULL); | |
146 | -#else | |
147 | - /* Takes a kimage from the axis devboard SDK. */ | |
148 | - kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000); | |
149 | - bootstrap_pc = 0x40004000; | |
150 | - /* magic for boot. */ | |
151 | - env->regs[8] = 0x56902387; | |
152 | - env->regs[9] = 0x40004000 + kernel_size; | |
153 | -#endif | |
145 | + &entry, NULL, NULL); | |
146 | + bootstrap_pc = entry; | |
147 | + if (kernel_size < 0) { | |
148 | + /* Takes a kimage from the axis devboard SDK. */ | |
149 | + kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000); | |
150 | + bootstrap_pc = 0x40004000; | |
151 | + /* magic for boot. */ | |
152 | + env->regs[8] = 0x56902387; | |
153 | + env->regs[9] = 0x40004000 + kernel_size; | |
154 | + } | |
154 | 155 | } |
155 | 156 | env->pc = bootstrap_pc; |
156 | 157 | |
... | ... | @@ -158,11 +159,6 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, |
158 | 159 | printf ("ram size =%ld\n", ram_size); |
159 | 160 | } |
160 | 161 | |
161 | -void DMA_run(void) | |
162 | -{ | |
163 | - etraxfs_dmac_run(etraxfs_dmac); | |
164 | -} | |
165 | - | |
166 | 162 | QEMUMachine bareetraxfs_machine = { |
167 | 163 | "bareetraxfs", |
168 | 164 | "Bare ETRAX FS board", | ... | ... |
hw/etraxfs_dma.c
... | ... | @@ -273,6 +273,7 @@ static void channel_load_d(struct fs_dma_ctrl *ctrl, int c) |
273 | 273 | sizeof ctrl->channels[c].current_d); |
274 | 274 | |
275 | 275 | D(dump_d(c, &ctrl->channels[c].current_d)); |
276 | + ctrl->channels[c].regs[RW_DATA] = addr; | |
276 | 277 | ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = |
277 | 278 | (uint32_t)ctrl->channels[c].current_d.buf; |
278 | 279 | } |
... | ... | @@ -561,7 +562,7 @@ dma_writel (void *opaque, target_phys_addr_t addr, uint32_t value) |
561 | 562 | switch (addr) |
562 | 563 | { |
563 | 564 | case RW_DATA: |
564 | - printf("RW_DATA=%x\n", value); | |
565 | + ctrl->channels[c].regs[addr] = value; | |
565 | 566 | break; |
566 | 567 | |
567 | 568 | case RW_CFG: |
... | ... | @@ -658,6 +659,13 @@ void etraxfs_dmac_connect_client(void *opaque, int c, |
658 | 659 | } |
659 | 660 | |
660 | 661 | |
662 | +static void *etraxfs_dmac; | |
663 | +void DMA_run(void) | |
664 | +{ | |
665 | + if (etraxfs_dmac) | |
666 | + etraxfs_dmac_run(etraxfs_dmac); | |
667 | +} | |
668 | + | |
661 | 669 | void *etraxfs_dmac_init(CPUState *env, |
662 | 670 | target_phys_addr_t base, int nr_channels) |
663 | 671 | { |
... | ... | @@ -686,6 +694,8 @@ void *etraxfs_dmac_init(CPUState *env, |
686 | 694 | ctrl->channels[i].regmap); |
687 | 695 | } |
688 | 696 | |
697 | + /* Hax, we only support one DMA controller at a time. */ | |
698 | + etraxfs_dmac = ctrl; | |
689 | 699 | return ctrl; |
690 | 700 | err: |
691 | 701 | qemu_free(ctrl->channels); | ... | ... |