Commit 48318011da95864717cd0d1d9c2877e7c66fac0d
1 parent
a3ea5df5
Update the etrax machine.
* Use CFI-0002 flashes. * Connect one of the ethernet blocks. * Simplified irq numbering. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4430 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
46 additions
and
20 deletions
Makefile.target
@@ -588,12 +588,14 @@ CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE | @@ -588,12 +588,14 @@ CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE | ||
588 | endif | 588 | endif |
589 | ifeq ($(TARGET_BASE_ARCH), cris) | 589 | ifeq ($(TARGET_BASE_ARCH), cris) |
590 | OBJS+= etraxfs.o | 590 | OBJS+= etraxfs.o |
591 | +OBJS+= etraxfs_dma.o | ||
591 | OBJS+= etraxfs_pic.o | 592 | OBJS+= etraxfs_pic.o |
593 | +OBJS+= etraxfs_eth.o | ||
592 | OBJS+= etraxfs_timer.o | 594 | OBJS+= etraxfs_timer.o |
593 | OBJS+= etraxfs_ser.o | 595 | OBJS+= etraxfs_ser.o |
594 | 596 | ||
595 | OBJS+= ptimer.o | 597 | OBJS+= ptimer.o |
596 | -OBJS+= pflash_cfi01.o | 598 | +OBJS+= pflash_cfi02.o |
597 | endif | 599 | endif |
598 | ifeq ($(TARGET_BASE_ARCH), sparc) | 600 | ifeq ($(TARGET_BASE_ARCH), sparc) |
599 | ifeq ($(TARGET_ARCH), sparc64) | 601 | ifeq ($(TARGET_ARCH), sparc64) |
hw/etraxfs.c
@@ -24,10 +24,14 @@ | @@ -24,10 +24,14 @@ | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #include <sys/time.h> | 25 | #include <sys/time.h> |
26 | #include "hw.h" | 26 | #include "hw.h" |
27 | -#include "sysemu.h" | 27 | +#include "net.h" |
28 | #include "flash.h" | 28 | #include "flash.h" |
29 | +#include "sysemu.h" | ||
30 | +#include "devices.h" | ||
29 | #include "boards.h" | 31 | #include "boards.h" |
30 | 32 | ||
33 | +#include "etraxfs_dma.h" | ||
34 | + | ||
31 | static void main_cpu_reset(void *opaque) | 35 | static void main_cpu_reset(void *opaque) |
32 | { | 36 | { |
33 | CPUState *env = opaque; | 37 | CPUState *env = opaque; |
@@ -36,14 +40,18 @@ static void main_cpu_reset(void *opaque) | @@ -36,14 +40,18 @@ static void main_cpu_reset(void *opaque) | ||
36 | 40 | ||
37 | /* Init functions for different blocks. */ | 41 | /* Init functions for different blocks. */ |
38 | extern qemu_irq *etraxfs_pic_init(CPUState *env, target_phys_addr_t base); | 42 | extern qemu_irq *etraxfs_pic_init(CPUState *env, target_phys_addr_t base); |
39 | -void etraxfs_timer_init(CPUState *env, qemu_irq *irqs, | 43 | +void etraxfs_timer_init(CPUState *env, qemu_irq *irqs, |
40 | target_phys_addr_t base); | 44 | target_phys_addr_t base); |
45 | +void *etraxfs_eth_init(NICInfo *nd, CPUState *env, | ||
46 | + qemu_irq *irq, target_phys_addr_t base); | ||
41 | void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr, | 47 | void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr, |
42 | target_phys_addr_t base); | 48 | target_phys_addr_t base); |
43 | 49 | ||
44 | #define FLASH_SIZE 0x2000000 | 50 | #define FLASH_SIZE 0x2000000 |
45 | #define INTMEM_SIZE (128 * 1024) | 51 | #define INTMEM_SIZE (128 * 1024) |
46 | 52 | ||
53 | +static void *etraxfs_dmac; | ||
54 | + | ||
47 | static | 55 | static |
48 | void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | 56 | void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, |
49 | const char *boot_device, DisplayState *ds, | 57 | const char *boot_device, DisplayState *ds, |
@@ -52,8 +60,9 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | @@ -52,8 +60,9 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | ||
52 | { | 60 | { |
53 | CPUState *env; | 61 | CPUState *env; |
54 | qemu_irq *pic; | 62 | qemu_irq *pic; |
63 | + struct etraxfs_dma_client *eth0; | ||
55 | int kernel_size; | 64 | int kernel_size; |
56 | - int index; | 65 | + int i; |
57 | ram_addr_t phys_ram; | 66 | ram_addr_t phys_ram; |
58 | ram_addr_t phys_intmem; | 67 | ram_addr_t phys_intmem; |
59 | 68 | ||
@@ -84,23 +93,36 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | @@ -84,23 +93,36 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | ||
84 | cpu_register_physical_memory(0x04000000, FLASH_SIZE, IO_MEM_ROM); | 93 | cpu_register_physical_memory(0x04000000, FLASH_SIZE, IO_MEM_ROM); |
85 | cpu_register_physical_memory(0x84000000, FLASH_SIZE, | 94 | cpu_register_physical_memory(0x84000000, FLASH_SIZE, |
86 | 0x04000000 | IO_MEM_ROM); | 95 | 0x04000000 | IO_MEM_ROM); |
87 | - index = drive_get_index(IF_PFLASH, 0, 0); | ||
88 | - pflash_cfi01_register(0x80000000, FLASH_SIZE, | ||
89 | - drives_table[index].bdrv, 65536, FLASH_SIZE >> 16, | ||
90 | - 4, 0x0000, 0x0000, 0x0000, 0x0000); | 96 | + i = drive_get_index(IF_PFLASH, 0, 0); |
97 | + pflash_cfi02_register(0x80000000, qemu_ram_alloc(FLASH_SIZE), | ||
98 | + drives_table[i].bdrv, (64 * 1024), | ||
99 | + FLASH_SIZE >> 16, | ||
100 | + 1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa); | ||
91 | 101 | ||
92 | pic = etraxfs_pic_init(env, 0xb001c000); | 102 | pic = etraxfs_pic_init(env, 0xb001c000); |
103 | + etraxfs_dmac = etraxfs_dmac_init(env, 0xb0000000, 10); | ||
104 | + for (i = 0; i < 10; i++) { | ||
105 | + /* On ETRAX, odd numbered channels are inputs. */ | ||
106 | + etraxfs_dmac_connect(etraxfs_dmac, i, pic + 7 + i, i & 1); | ||
107 | + } | ||
108 | + | ||
109 | + /* It has 2, but let's start with one ethernet block. */ | ||
110 | + eth0 = etraxfs_eth_init(&nd_table[0], env, pic + 25, 0xb0034000); | ||
111 | + | ||
112 | + /* The DMA Connector block is missing, hardwire things for now. */ | ||
113 | + etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth0); | ||
114 | + etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth0 + 1); | ||
115 | + | ||
93 | /* 2 timers. */ | 116 | /* 2 timers. */ |
94 | - etraxfs_timer_init(env, pic + 26, 0xb001e000); | ||
95 | - etraxfs_timer_init(env, pic + 26, 0xb005e000); | ||
96 | - /* 4 serial ports. */ | ||
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); | 117 | + etraxfs_timer_init(env, pic + 0x1b, 0xb001e000); |
118 | + etraxfs_timer_init(env, pic + 0x1b, 0xb005e000); | ||
119 | + | ||
120 | + for (i = 0; i < 4; i++) { | ||
121 | + if (serial_hds[i]) { | ||
122 | + etraxfs_ser_init(env, pic + 0x14 + i, | ||
123 | + serial_hds[i], 0xb0026000 + i * 0x2000); | ||
124 | + } | ||
125 | + } | ||
104 | 126 | ||
105 | #if 1 | 127 | #if 1 |
106 | /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis devboard | 128 | /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis devboard |
@@ -126,7 +148,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | @@ -126,7 +148,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | ||
126 | } | 148 | } |
127 | 149 | ||
128 | printf ("pc =%x\n", env->pc); | 150 | printf ("pc =%x\n", env->pc); |
129 | - printf ("ram size =%d\n", ram_size); | 151 | + printf ("ram size =%ld\n", ram_size); |
130 | printf ("kernel name =%s\n", kernel_filename); | 152 | printf ("kernel name =%s\n", kernel_filename); |
131 | printf ("kernel size =%d\n", kernel_size); | 153 | printf ("kernel size =%d\n", kernel_size); |
132 | printf ("cpu haltd =%d\n", env->halted); | 154 | printf ("cpu haltd =%d\n", env->halted); |
@@ -134,11 +156,12 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | @@ -134,11 +156,12 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, | ||
134 | 156 | ||
135 | void DMA_run(void) | 157 | void DMA_run(void) |
136 | { | 158 | { |
159 | + etraxfs_dmac_run(etraxfs_dmac); | ||
137 | } | 160 | } |
138 | 161 | ||
139 | QEMUMachine bareetraxfs_machine = { | 162 | QEMUMachine bareetraxfs_machine = { |
140 | "bareetraxfs", | 163 | "bareetraxfs", |
141 | "Bare ETRAX FS board", | 164 | "Bare ETRAX FS board", |
142 | bareetraxfs_init, | 165 | bareetraxfs_init, |
143 | - 0x800000, | 166 | + 0x4000000, |
144 | }; | 167 | }; |
hw/etraxfs_pic.c
@@ -154,6 +154,7 @@ static void etraxfs_pic_handler(void *opaque, int irq, int level) | @@ -154,6 +154,7 @@ static void etraxfs_pic_handler(void *opaque, int irq, int level) | ||
154 | __func__, irq, level, | 154 | __func__, irq, level, |
155 | fs->rw_mask, fs->r_vect, fs->r_masked_vect)); | 155 | fs->rw_mask, fs->r_vect, fs->r_masked_vect)); |
156 | 156 | ||
157 | + irq -= 1; | ||
157 | fs->r_vect &= ~(1 << irq); | 158 | fs->r_vect &= ~(1 << irq); |
158 | fs->r_vect |= (!!level << irq); | 159 | fs->r_vect |= (!!level << irq); |
159 | fs->r_masked_vect = fs->r_vect & fs->rw_mask; | 160 | fs->r_masked_vect = fs->r_vect & fs->rw_mask; |