root / hw / realview.c @ 0ed8b6f6
History | View | Annotate | Download (13.7 kB)
1 | 5fafdf24 | ths | /*
|
---|---|---|---|
2 | e69954b9 | pbrook | * ARM RealView Baseboard System emulation.
|
3 | e69954b9 | pbrook | *
|
4 | a1bb27b1 | pbrook | * Copyright (c) 2006-2007 CodeSourcery.
|
5 | e69954b9 | pbrook | * Written by Paul Brook
|
6 | e69954b9 | pbrook | *
|
7 | 8e31bf38 | Matthew Fernandez | * This code is licensed under the GPL.
|
8 | e69954b9 | pbrook | */
|
9 | e69954b9 | pbrook | |
10 | 2e9bdce5 | Paul Brook | #include "sysbus.h" |
11 | 87ecb68b | pbrook | #include "arm-misc.h" |
12 | 87ecb68b | pbrook | #include "primecell.h" |
13 | 87ecb68b | pbrook | #include "devices.h" |
14 | 87ecb68b | pbrook | #include "pci.h" |
15 | 87ecb68b | pbrook | #include "net.h" |
16 | 87ecb68b | pbrook | #include "sysemu.h" |
17 | 87ecb68b | pbrook | #include "boards.h" |
18 | d1157ca4 | Oskar Andero | #include "i2c.h" |
19 | 2446333c | Blue Swirl | #include "blockdev.h" |
20 | 35e87820 | Avi Kivity | #include "exec-memory.h" |
21 | e69954b9 | pbrook | |
22 | 0ef849d7 | Paul Brook | #define SMP_BOOT_ADDR 0xe0000000 |
23 | 078758d0 | Evgeny Voevodin | #define SMP_BOOTREG_ADDR 0x10000030 |
24 | eee48504 | Paul Brook | |
25 | e69954b9 | pbrook | /* Board init. */
|
26 | e69954b9 | pbrook | |
27 | f93eb9ff | balrog | static struct arm_boot_info realview_binfo = { |
28 | 0ef849d7 | Paul Brook | .smp_loader_start = SMP_BOOT_ADDR, |
29 | 078758d0 | Evgeny Voevodin | .smp_bootreg_addr = SMP_BOOTREG_ADDR, |
30 | f93eb9ff | balrog | }; |
31 | f93eb9ff | balrog | |
32 | f7c70325 | Paul Brook | /* The following two lists must be consistent. */
|
33 | c988bfad | Paul Brook | enum realview_board_type {
|
34 | c988bfad | Paul Brook | BOARD_EB, |
35 | 0ef849d7 | Paul Brook | BOARD_EB_MPCORE, |
36 | f7c70325 | Paul Brook | BOARD_PB_A8, |
37 | f7c70325 | Paul Brook | BOARD_PBX_A9, |
38 | f7c70325 | Paul Brook | }; |
39 | f7c70325 | Paul Brook | |
40 | d05ac8fa | Blue Swirl | static const int realview_board_id[] = { |
41 | f7c70325 | Paul Brook | 0x33b,
|
42 | f7c70325 | Paul Brook | 0x33b,
|
43 | f7c70325 | Paul Brook | 0x769,
|
44 | f7c70325 | Paul Brook | 0x76d
|
45 | c988bfad | Paul Brook | }; |
46 | c988bfad | Paul Brook | |
47 | c227f099 | Anthony Liguori | static void realview_init(ram_addr_t ram_size, |
48 | 3023f332 | aliguori | const char *boot_device, |
49 | e69954b9 | pbrook | const char *kernel_filename, const char *kernel_cmdline, |
50 | c988bfad | Paul Brook | const char *initrd_filename, const char *cpu_model, |
51 | c988bfad | Paul Brook | enum realview_board_type board_type)
|
52 | e69954b9 | pbrook | { |
53 | 9077f01b | Andreas Färber | ARMCPU *cpu = NULL;
|
54 | 9077f01b | Andreas Färber | CPUARMState *env; |
55 | 35e87820 | Avi Kivity | MemoryRegion *sysmem = get_system_memory(); |
56 | 35e87820 | Avi Kivity | MemoryRegion *ram_lo = g_new(MemoryRegion, 1);
|
57 | 35e87820 | Avi Kivity | MemoryRegion *ram_hi = g_new(MemoryRegion, 1);
|
58 | 35e87820 | Avi Kivity | MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
|
59 | 35e87820 | Avi Kivity | MemoryRegion *ram_hack = g_new(MemoryRegion, 1);
|
60 | 03a0e944 | Peter Maydell | DeviceState *dev, *sysctl, *gpio2, *pl041; |
61 | c988bfad | Paul Brook | SysBusDevice *busdev; |
62 | fe7e8758 | Paul Brook | qemu_irq *irqp; |
63 | fe7e8758 | Paul Brook | qemu_irq pic[64];
|
64 | 26883c69 | Peter Maydell | qemu_irq mmc_irq[2];
|
65 | e69954b9 | pbrook | PCIBus *pci_bus; |
66 | e69954b9 | pbrook | NICInfo *nd; |
67 | eee48504 | Paul Brook | i2c_bus *i2c; |
68 | e69954b9 | pbrook | int n;
|
69 | 0ef849d7 | Paul Brook | int done_nic = 0; |
70 | 9ee6e8bb | pbrook | qemu_irq cpu_irq[4];
|
71 | f7c70325 | Paul Brook | int is_mpcore = 0; |
72 | f7c70325 | Paul Brook | int is_pb = 0; |
73 | 26e92f65 | Paul Brook | uint32_t proc_id = 0;
|
74 | 0ef849d7 | Paul Brook | uint32_t sys_id; |
75 | 0ef849d7 | Paul Brook | ram_addr_t low_ram_size; |
76 | e69954b9 | pbrook | |
77 | f7c70325 | Paul Brook | switch (board_type) {
|
78 | f7c70325 | Paul Brook | case BOARD_EB:
|
79 | f7c70325 | Paul Brook | break;
|
80 | f7c70325 | Paul Brook | case BOARD_EB_MPCORE:
|
81 | f7c70325 | Paul Brook | is_mpcore = 1;
|
82 | f7c70325 | Paul Brook | break;
|
83 | f7c70325 | Paul Brook | case BOARD_PB_A8:
|
84 | f7c70325 | Paul Brook | is_pb = 1;
|
85 | f7c70325 | Paul Brook | break;
|
86 | f7c70325 | Paul Brook | case BOARD_PBX_A9:
|
87 | f7c70325 | Paul Brook | is_mpcore = 1;
|
88 | f7c70325 | Paul Brook | is_pb = 1;
|
89 | f7c70325 | Paul Brook | break;
|
90 | f7c70325 | Paul Brook | } |
91 | c988bfad | Paul Brook | for (n = 0; n < smp_cpus; n++) { |
92 | 9077f01b | Andreas Färber | cpu = cpu_arm_init(cpu_model); |
93 | 9077f01b | Andreas Färber | if (!cpu) {
|
94 | 9ee6e8bb | pbrook | fprintf(stderr, "Unable to find CPU definition\n");
|
95 | 9ee6e8bb | pbrook | exit(1);
|
96 | 9ee6e8bb | pbrook | } |
97 | 4bd74661 | Andreas Färber | irqp = arm_pic_init_cpu(cpu); |
98 | fe7e8758 | Paul Brook | cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ]; |
99 | aaed909a | bellard | } |
100 | 9077f01b | Andreas Färber | env = &cpu->env; |
101 | 26e92f65 | Paul Brook | if (arm_feature(env, ARM_FEATURE_V7)) {
|
102 | f7c70325 | Paul Brook | if (is_mpcore) {
|
103 | f7c70325 | Paul Brook | proc_id = 0x0c000000;
|
104 | f7c70325 | Paul Brook | } else {
|
105 | f7c70325 | Paul Brook | proc_id = 0x0e000000;
|
106 | f7c70325 | Paul Brook | } |
107 | 26e92f65 | Paul Brook | } else if (arm_feature(env, ARM_FEATURE_V6K)) { |
108 | 26e92f65 | Paul Brook | proc_id = 0x06000000;
|
109 | 26e92f65 | Paul Brook | } else if (arm_feature(env, ARM_FEATURE_V6)) { |
110 | 26e92f65 | Paul Brook | proc_id = 0x04000000;
|
111 | 26e92f65 | Paul Brook | } else {
|
112 | 26e92f65 | Paul Brook | proc_id = 0x02000000;
|
113 | 26e92f65 | Paul Brook | } |
114 | aaed909a | bellard | |
115 | 21a88941 | Paul Brook | if (is_pb && ram_size > 0x20000000) { |
116 | 21a88941 | Paul Brook | /* Core tile RAM. */
|
117 | 21a88941 | Paul Brook | low_ram_size = ram_size - 0x20000000;
|
118 | 21a88941 | Paul Brook | ram_size = 0x20000000;
|
119 | c5705a77 | Avi Kivity | memory_region_init_ram(ram_lo, "realview.lowmem", low_ram_size);
|
120 | c5705a77 | Avi Kivity | vmstate_register_ram_global(ram_lo); |
121 | 35e87820 | Avi Kivity | memory_region_add_subregion(sysmem, 0x20000000, ram_lo);
|
122 | 21a88941 | Paul Brook | } |
123 | 21a88941 | Paul Brook | |
124 | c5705a77 | Avi Kivity | memory_region_init_ram(ram_hi, "realview.highmem", ram_size);
|
125 | c5705a77 | Avi Kivity | vmstate_register_ram_global(ram_hi); |
126 | 0ef849d7 | Paul Brook | low_ram_size = ram_size; |
127 | 0ef849d7 | Paul Brook | if (low_ram_size > 0x10000000) |
128 | 0ef849d7 | Paul Brook | low_ram_size = 0x10000000;
|
129 | e69954b9 | pbrook | /* SDRAM at address zero. */
|
130 | 35e87820 | Avi Kivity | memory_region_init_alias(ram_alias, "realview.alias",
|
131 | 35e87820 | Avi Kivity | ram_hi, 0, low_ram_size);
|
132 | 35e87820 | Avi Kivity | memory_region_add_subregion(sysmem, 0, ram_alias);
|
133 | 0ef849d7 | Paul Brook | if (is_pb) {
|
134 | 0ef849d7 | Paul Brook | /* And again at a high address. */
|
135 | 35e87820 | Avi Kivity | memory_region_add_subregion(sysmem, 0x70000000, ram_hi);
|
136 | 0ef849d7 | Paul Brook | } else {
|
137 | 0ef849d7 | Paul Brook | ram_size = low_ram_size; |
138 | 0ef849d7 | Paul Brook | } |
139 | e69954b9 | pbrook | |
140 | 0ef849d7 | Paul Brook | sys_id = is_pb ? 0x01780500 : 0xc1400400; |
141 | 26883c69 | Peter Maydell | sysctl = qdev_create(NULL, "realview_sysctl"); |
142 | 26883c69 | Peter Maydell | qdev_prop_set_uint32(sysctl, "sys_id", sys_id);
|
143 | 26883c69 | Peter Maydell | qdev_prop_set_uint32(sysctl, "proc_id", proc_id);
|
144 | 7a65c8cc | Peter Maydell | qdev_init_nofail(sysctl); |
145 | 26883c69 | Peter Maydell | sysbus_mmio_map(sysbus_from_qdev(sysctl), 0, 0x10000000); |
146 | 9ee6e8bb | pbrook | |
147 | c988bfad | Paul Brook | if (is_mpcore) {
|
148 | 96eacf64 | Peter Maydell | target_phys_addr_t periphbase; |
149 | f7c70325 | Paul Brook | dev = qdev_create(NULL, is_pb ? "a9mpcore_priv": "realview_mpcore"); |
150 | c988bfad | Paul Brook | qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
|
151 | c988bfad | Paul Brook | qdev_init_nofail(dev); |
152 | c988bfad | Paul Brook | busdev = sysbus_from_qdev(dev); |
153 | f7c70325 | Paul Brook | if (is_pb) {
|
154 | 96eacf64 | Peter Maydell | periphbase = 0x1f000000;
|
155 | f7c70325 | Paul Brook | } else {
|
156 | 96eacf64 | Peter Maydell | periphbase = 0x10100000;
|
157 | f7c70325 | Paul Brook | } |
158 | 96eacf64 | Peter Maydell | sysbus_mmio_map(busdev, 0, periphbase);
|
159 | c988bfad | Paul Brook | for (n = 0; n < smp_cpus; n++) { |
160 | c988bfad | Paul Brook | sysbus_connect_irq(busdev, n, cpu_irq[n]); |
161 | c988bfad | Paul Brook | } |
162 | 96eacf64 | Peter Maydell | sysbus_create_varargs("l2x0", periphbase + 0x2000, NULL); |
163 | 96eacf64 | Peter Maydell | /* Both A9 and 11MPCore put the GIC CPU i/f at base + 0x100 */
|
164 | 96eacf64 | Peter Maydell | realview_binfo.gic_cpu_if_addr = periphbase + 0x100;
|
165 | 9ee6e8bb | pbrook | } else {
|
166 | 0ef849d7 | Paul Brook | uint32_t gic_addr = is_pb ? 0x1e000000 : 0x10040000; |
167 | 0ef849d7 | Paul Brook | /* For now just create the nIRQ GIC, and ignore the others. */
|
168 | 0ef849d7 | Paul Brook | dev = sysbus_create_simple("realview_gic", gic_addr, cpu_irq[0]); |
169 | fe7e8758 | Paul Brook | } |
170 | fe7e8758 | Paul Brook | for (n = 0; n < 64; n++) { |
171 | 067a3ddc | Paul Brook | pic[n] = qdev_get_gpio_in(dev, n); |
172 | 9ee6e8bb | pbrook | } |
173 | 9ee6e8bb | pbrook | |
174 | 03a0e944 | Peter Maydell | pl041 = qdev_create(NULL, "pl041"); |
175 | 03a0e944 | Peter Maydell | qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); |
176 | 03a0e944 | Peter Maydell | qdev_init_nofail(pl041); |
177 | 03a0e944 | Peter Maydell | sysbus_mmio_map(sysbus_from_qdev(pl041), 0, 0x10004000); |
178 | 03a0e944 | Peter Maydell | sysbus_connect_irq(sysbus_from_qdev(pl041), 0, pic[19]); |
179 | 03a0e944 | Peter Maydell | |
180 | 86394e96 | Paul Brook | sysbus_create_simple("pl050_keyboard", 0x10006000, pic[20]); |
181 | 86394e96 | Paul Brook | sysbus_create_simple("pl050_mouse", 0x10007000, pic[21]); |
182 | e69954b9 | pbrook | |
183 | a7d518a6 | Paul Brook | sysbus_create_simple("pl011", 0x10009000, pic[12]); |
184 | a7d518a6 | Paul Brook | sysbus_create_simple("pl011", 0x1000a000, pic[13]); |
185 | a7d518a6 | Paul Brook | sysbus_create_simple("pl011", 0x1000b000, pic[14]); |
186 | a7d518a6 | Paul Brook | sysbus_create_simple("pl011", 0x1000c000, pic[15]); |
187 | e69954b9 | pbrook | |
188 | e69954b9 | pbrook | /* DMA controller is optional, apparently. */
|
189 | b4496b13 | Paul Brook | sysbus_create_simple("pl081", 0x10030000, pic[24]); |
190 | e69954b9 | pbrook | |
191 | 6a824ec3 | Paul Brook | sysbus_create_simple("sp804", 0x10011000, pic[4]); |
192 | 6a824ec3 | Paul Brook | sysbus_create_simple("sp804", 0x10012000, pic[5]); |
193 | e69954b9 | pbrook | |
194 | 26883c69 | Peter Maydell | sysbus_create_simple("pl061", 0x10013000, pic[6]); |
195 | 26883c69 | Peter Maydell | sysbus_create_simple("pl061", 0x10014000, pic[7]); |
196 | 26883c69 | Peter Maydell | gpio2 = sysbus_create_simple("pl061", 0x10015000, pic[8]); |
197 | 26883c69 | Peter Maydell | |
198 | acb9b722 | Peter Maydell | sysbus_create_simple("pl111", 0x10020000, pic[23]); |
199 | e69954b9 | pbrook | |
200 | 26883c69 | Peter Maydell | dev = sysbus_create_varargs("pl181", 0x10005000, pic[17], pic[18], NULL); |
201 | 26883c69 | Peter Maydell | /* Wire up MMC card detect and read-only signals. These have
|
202 | 26883c69 | Peter Maydell | * to go to both the PL061 GPIO and the sysctl register.
|
203 | 26883c69 | Peter Maydell | * Note that the PL181 orders these lines (readonly,inserted)
|
204 | 26883c69 | Peter Maydell | * and the PL061 has them the other way about. Also the card
|
205 | 26883c69 | Peter Maydell | * detect line is inverted.
|
206 | 26883c69 | Peter Maydell | */
|
207 | 26883c69 | Peter Maydell | mmc_irq[0] = qemu_irq_split(
|
208 | 26883c69 | Peter Maydell | qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT), |
209 | 26883c69 | Peter Maydell | qdev_get_gpio_in(gpio2, 1));
|
210 | 26883c69 | Peter Maydell | mmc_irq[1] = qemu_irq_split(
|
211 | 26883c69 | Peter Maydell | qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), |
212 | 26883c69 | Peter Maydell | qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
|
213 | 26883c69 | Peter Maydell | qdev_connect_gpio_out(dev, 0, mmc_irq[0]); |
214 | 26883c69 | Peter Maydell | qdev_connect_gpio_out(dev, 1, mmc_irq[1]); |
215 | a1bb27b1 | pbrook | |
216 | a63bdb31 | Paul Brook | sysbus_create_simple("pl031", 0x10017000, pic[10]); |
217 | 7e1543c2 | pbrook | |
218 | 0ef849d7 | Paul Brook | if (!is_pb) {
|
219 | 7d6e771f | Peter Maydell | dev = qdev_create(NULL, "realview_pci"); |
220 | 7d6e771f | Peter Maydell | busdev = sysbus_from_qdev(dev); |
221 | 7d6e771f | Peter Maydell | qdev_init_nofail(dev); |
222 | 7d6e771f | Peter Maydell | sysbus_mmio_map(busdev, 0, 0x61000000); /* PCI self-config */ |
223 | 7d6e771f | Peter Maydell | sysbus_mmio_map(busdev, 1, 0x62000000); /* PCI config */ |
224 | 7d6e771f | Peter Maydell | sysbus_mmio_map(busdev, 2, 0x63000000); /* PCI I/O */ |
225 | 7d6e771f | Peter Maydell | sysbus_connect_irq(busdev, 0, pic[48]); |
226 | 7d6e771f | Peter Maydell | sysbus_connect_irq(busdev, 1, pic[49]); |
227 | 7d6e771f | Peter Maydell | sysbus_connect_irq(busdev, 2, pic[50]); |
228 | 7d6e771f | Peter Maydell | sysbus_connect_irq(busdev, 3, pic[51]); |
229 | 0ef849d7 | Paul Brook | pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
|
230 | 0ef849d7 | Paul Brook | if (usb_enabled) {
|
231 | afb9a60e | Gerd Hoffmann | pci_create_simple(pci_bus, -1, "pci-ohci"); |
232 | 0ef849d7 | Paul Brook | } |
233 | 0ef849d7 | Paul Brook | n = drive_get_max_bus(IF_SCSI); |
234 | 0ef849d7 | Paul Brook | while (n >= 0) { |
235 | 0ef849d7 | Paul Brook | pci_create_simple(pci_bus, -1, "lsi53c895a"); |
236 | 0ef849d7 | Paul Brook | n--; |
237 | 0ef849d7 | Paul Brook | } |
238 | e69954b9 | pbrook | } |
239 | e69954b9 | pbrook | for(n = 0; n < nb_nics; n++) { |
240 | e69954b9 | pbrook | nd = &nd_table[n]; |
241 | 0ae18cee | aliguori | |
242 | e6b3c8ca | Peter Maydell | if (!done_nic && (!nd->model ||
|
243 | e6b3c8ca | Peter Maydell | strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0)) { |
244 | 0ef849d7 | Paul Brook | if (is_pb) {
|
245 | 0ef849d7 | Paul Brook | lan9118_init(nd, 0x4e000000, pic[28]); |
246 | 0ef849d7 | Paul Brook | } else {
|
247 | 0ef849d7 | Paul Brook | smc91c111_init(nd, 0x4e000000, pic[28]); |
248 | 0ef849d7 | Paul Brook | } |
249 | 0ef849d7 | Paul Brook | done_nic = 1;
|
250 | e69954b9 | pbrook | } else {
|
251 | 07caea31 | Markus Armbruster | pci_nic_init_nofail(nd, "rtl8139", NULL); |
252 | e69954b9 | pbrook | } |
253 | e69954b9 | pbrook | } |
254 | e69954b9 | pbrook | |
255 | d1157ca4 | Oskar Andero | dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL); |
256 | eee48504 | Paul Brook | i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
|
257 | eee48504 | Paul Brook | i2c_create_slave(i2c, "ds1338", 0x68); |
258 | eee48504 | Paul Brook | |
259 | e69954b9 | pbrook | /* Memory map for RealView Emulation Baseboard: */
|
260 | e69954b9 | pbrook | /* 0x10000000 System registers. */
|
261 | e69954b9 | pbrook | /* 0x10001000 System controller. */
|
262 | eee48504 | Paul Brook | /* 0x10002000 Two-Wire Serial Bus. */
|
263 | e69954b9 | pbrook | /* 0x10003000 Reserved. */
|
264 | e69954b9 | pbrook | /* 0x10004000 AACI. */
|
265 | e69954b9 | pbrook | /* 0x10005000 MCI. */
|
266 | e69954b9 | pbrook | /* 0x10006000 KMI0. */
|
267 | e69954b9 | pbrook | /* 0x10007000 KMI1. */
|
268 | 0ef849d7 | Paul Brook | /* 0x10008000 Character LCD. (EB) */
|
269 | e69954b9 | pbrook | /* 0x10009000 UART0. */
|
270 | e69954b9 | pbrook | /* 0x1000a000 UART1. */
|
271 | e69954b9 | pbrook | /* 0x1000b000 UART2. */
|
272 | e69954b9 | pbrook | /* 0x1000c000 UART3. */
|
273 | e69954b9 | pbrook | /* 0x1000d000 SSPI. */
|
274 | e69954b9 | pbrook | /* 0x1000e000 SCI. */
|
275 | e69954b9 | pbrook | /* 0x1000f000 Reserved. */
|
276 | e69954b9 | pbrook | /* 0x10010000 Watchdog. */
|
277 | e69954b9 | pbrook | /* 0x10011000 Timer 0+1. */
|
278 | e69954b9 | pbrook | /* 0x10012000 Timer 2+3. */
|
279 | e69954b9 | pbrook | /* 0x10013000 GPIO 0. */
|
280 | e69954b9 | pbrook | /* 0x10014000 GPIO 1. */
|
281 | e69954b9 | pbrook | /* 0x10015000 GPIO 2. */
|
282 | 0ef849d7 | Paul Brook | /* 0x10002000 Two-Wire Serial Bus - DVI. (PB) */
|
283 | 7e1543c2 | pbrook | /* 0x10017000 RTC. */
|
284 | e69954b9 | pbrook | /* 0x10018000 DMC. */
|
285 | e69954b9 | pbrook | /* 0x10019000 PCI controller config. */
|
286 | e69954b9 | pbrook | /* 0x10020000 CLCD. */
|
287 | e69954b9 | pbrook | /* 0x10030000 DMA Controller. */
|
288 | 0ef849d7 | Paul Brook | /* 0x10040000 GIC1. (EB) */
|
289 | 0ef849d7 | Paul Brook | /* 0x10050000 GIC2. (EB) */
|
290 | 0ef849d7 | Paul Brook | /* 0x10060000 GIC3. (EB) */
|
291 | 0ef849d7 | Paul Brook | /* 0x10070000 GIC4. (EB) */
|
292 | e69954b9 | pbrook | /* 0x10080000 SMC. */
|
293 | 0ef849d7 | Paul Brook | /* 0x1e000000 GIC1. (PB) */
|
294 | 0ef849d7 | Paul Brook | /* 0x1e001000 GIC2. (PB) */
|
295 | 0ef849d7 | Paul Brook | /* 0x1e002000 GIC3. (PB) */
|
296 | 0ef849d7 | Paul Brook | /* 0x1e003000 GIC4. (PB) */
|
297 | e69954b9 | pbrook | /* 0x40000000 NOR flash. */
|
298 | e69954b9 | pbrook | /* 0x44000000 DoC flash. */
|
299 | e69954b9 | pbrook | /* 0x48000000 SRAM. */
|
300 | e69954b9 | pbrook | /* 0x4c000000 Configuration flash. */
|
301 | e69954b9 | pbrook | /* 0x4e000000 Ethernet. */
|
302 | e69954b9 | pbrook | /* 0x4f000000 USB. */
|
303 | e69954b9 | pbrook | /* 0x50000000 PISMO. */
|
304 | e69954b9 | pbrook | /* 0x54000000 PISMO. */
|
305 | e69954b9 | pbrook | /* 0x58000000 PISMO. */
|
306 | e69954b9 | pbrook | /* 0x5c000000 PISMO. */
|
307 | e69954b9 | pbrook | /* 0x60000000 PCI. */
|
308 | e69954b9 | pbrook | /* 0x61000000 PCI Self Config. */
|
309 | e69954b9 | pbrook | /* 0x62000000 PCI Config. */
|
310 | e69954b9 | pbrook | /* 0x63000000 PCI IO. */
|
311 | e69954b9 | pbrook | /* 0x64000000 PCI mem 0. */
|
312 | e69954b9 | pbrook | /* 0x68000000 PCI mem 1. */
|
313 | e69954b9 | pbrook | /* 0x6c000000 PCI mem 2. */
|
314 | e69954b9 | pbrook | |
315 | 7ffab4d7 | pbrook | /* ??? Hack to map an additional page of ram for the secondary CPU
|
316 | 7ffab4d7 | pbrook | startup code. I guess this works on real hardware because the
|
317 | 7ffab4d7 | pbrook | BootROM happens to be in ROM/flash or in memory that isn't clobbered
|
318 | 7ffab4d7 | pbrook | until after Linux boots the secondary CPUs. */
|
319 | c5705a77 | Avi Kivity | memory_region_init_ram(ram_hack, "realview.hack", 0x1000); |
320 | c5705a77 | Avi Kivity | vmstate_register_ram_global(ram_hack); |
321 | 35e87820 | Avi Kivity | memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, ram_hack); |
322 | 7ffab4d7 | pbrook | |
323 | f93eb9ff | balrog | realview_binfo.ram_size = ram_size; |
324 | f93eb9ff | balrog | realview_binfo.kernel_filename = kernel_filename; |
325 | f93eb9ff | balrog | realview_binfo.kernel_cmdline = kernel_cmdline; |
326 | f93eb9ff | balrog | realview_binfo.initrd_filename = initrd_filename; |
327 | c988bfad | Paul Brook | realview_binfo.nb_cpus = smp_cpus; |
328 | f7c70325 | Paul Brook | realview_binfo.board_id = realview_board_id[board_type]; |
329 | 21a88941 | Paul Brook | realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0); |
330 | 3aaa8dfa | Andreas Färber | arm_load_kernel(arm_env_get_cpu(first_cpu), &realview_binfo); |
331 | e69954b9 | pbrook | } |
332 | e69954b9 | pbrook | |
333 | c988bfad | Paul Brook | static void realview_eb_init(ram_addr_t ram_size, |
334 | c988bfad | Paul Brook | const char *boot_device, |
335 | c988bfad | Paul Brook | const char *kernel_filename, const char *kernel_cmdline, |
336 | c988bfad | Paul Brook | const char *initrd_filename, const char *cpu_model) |
337 | c988bfad | Paul Brook | { |
338 | c988bfad | Paul Brook | if (!cpu_model) {
|
339 | c988bfad | Paul Brook | cpu_model = "arm926";
|
340 | c988bfad | Paul Brook | } |
341 | c988bfad | Paul Brook | realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline, |
342 | c988bfad | Paul Brook | initrd_filename, cpu_model, BOARD_EB); |
343 | c988bfad | Paul Brook | } |
344 | c988bfad | Paul Brook | |
345 | c988bfad | Paul Brook | static void realview_eb_mpcore_init(ram_addr_t ram_size, |
346 | c988bfad | Paul Brook | const char *boot_device, |
347 | c988bfad | Paul Brook | const char *kernel_filename, const char *kernel_cmdline, |
348 | c988bfad | Paul Brook | const char *initrd_filename, const char *cpu_model) |
349 | c988bfad | Paul Brook | { |
350 | c988bfad | Paul Brook | if (!cpu_model) {
|
351 | c988bfad | Paul Brook | cpu_model = "arm11mpcore";
|
352 | c988bfad | Paul Brook | } |
353 | c988bfad | Paul Brook | realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline, |
354 | c988bfad | Paul Brook | initrd_filename, cpu_model, BOARD_EB_MPCORE); |
355 | c988bfad | Paul Brook | } |
356 | c988bfad | Paul Brook | |
357 | 0ef849d7 | Paul Brook | static void realview_pb_a8_init(ram_addr_t ram_size, |
358 | 0ef849d7 | Paul Brook | const char *boot_device, |
359 | 0ef849d7 | Paul Brook | const char *kernel_filename, const char *kernel_cmdline, |
360 | 0ef849d7 | Paul Brook | const char *initrd_filename, const char *cpu_model) |
361 | 0ef849d7 | Paul Brook | { |
362 | 0ef849d7 | Paul Brook | if (!cpu_model) {
|
363 | 0ef849d7 | Paul Brook | cpu_model = "cortex-a8";
|
364 | 0ef849d7 | Paul Brook | } |
365 | 0ef849d7 | Paul Brook | realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline, |
366 | 0ef849d7 | Paul Brook | initrd_filename, cpu_model, BOARD_PB_A8); |
367 | 0ef849d7 | Paul Brook | } |
368 | 0ef849d7 | Paul Brook | |
369 | f7c70325 | Paul Brook | static void realview_pbx_a9_init(ram_addr_t ram_size, |
370 | f7c70325 | Paul Brook | const char *boot_device, |
371 | f7c70325 | Paul Brook | const char *kernel_filename, const char *kernel_cmdline, |
372 | f7c70325 | Paul Brook | const char *initrd_filename, const char *cpu_model) |
373 | f7c70325 | Paul Brook | { |
374 | f7c70325 | Paul Brook | if (!cpu_model) {
|
375 | f7c70325 | Paul Brook | cpu_model = "cortex-a9";
|
376 | f7c70325 | Paul Brook | } |
377 | f7c70325 | Paul Brook | realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline, |
378 | f7c70325 | Paul Brook | initrd_filename, cpu_model, BOARD_PBX_A9); |
379 | f7c70325 | Paul Brook | } |
380 | f7c70325 | Paul Brook | |
381 | c988bfad | Paul Brook | static QEMUMachine realview_eb_machine = {
|
382 | c988bfad | Paul Brook | .name = "realview-eb",
|
383 | c9b1ae2c | blueswir1 | .desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)",
|
384 | c988bfad | Paul Brook | .init = realview_eb_init, |
385 | c988bfad | Paul Brook | .use_scsi = 1,
|
386 | c988bfad | Paul Brook | }; |
387 | c988bfad | Paul Brook | |
388 | c988bfad | Paul Brook | static QEMUMachine realview_eb_mpcore_machine = {
|
389 | c988bfad | Paul Brook | .name = "realview-eb-mpcore",
|
390 | c988bfad | Paul Brook | .desc = "ARM RealView Emulation Baseboard (ARM11MPCore)",
|
391 | c988bfad | Paul Brook | .init = realview_eb_mpcore_init, |
392 | c9b1ae2c | blueswir1 | .use_scsi = 1,
|
393 | c988bfad | Paul Brook | .max_cpus = 4,
|
394 | e69954b9 | pbrook | }; |
395 | f80f9ec9 | Anthony Liguori | |
396 | 0ef849d7 | Paul Brook | static QEMUMachine realview_pb_a8_machine = {
|
397 | 0ef849d7 | Paul Brook | .name = "realview-pb-a8",
|
398 | 0ef849d7 | Paul Brook | .desc = "ARM RealView Platform Baseboard for Cortex-A8",
|
399 | 0ef849d7 | Paul Brook | .init = realview_pb_a8_init, |
400 | f7c70325 | Paul Brook | }; |
401 | f7c70325 | Paul Brook | |
402 | f7c70325 | Paul Brook | static QEMUMachine realview_pbx_a9_machine = {
|
403 | f7c70325 | Paul Brook | .name = "realview-pbx-a9",
|
404 | f7c70325 | Paul Brook | .desc = "ARM RealView Platform Baseboard Explore for Cortex-A9",
|
405 | f7c70325 | Paul Brook | .init = realview_pbx_a9_init, |
406 | 0ef849d7 | Paul Brook | .use_scsi = 1,
|
407 | f7c70325 | Paul Brook | .max_cpus = 4,
|
408 | 0ef849d7 | Paul Brook | }; |
409 | 0ef849d7 | Paul Brook | |
410 | f80f9ec9 | Anthony Liguori | static void realview_machine_init(void) |
411 | f80f9ec9 | Anthony Liguori | { |
412 | c988bfad | Paul Brook | qemu_register_machine(&realview_eb_machine); |
413 | c988bfad | Paul Brook | qemu_register_machine(&realview_eb_mpcore_machine); |
414 | 0ef849d7 | Paul Brook | qemu_register_machine(&realview_pb_a8_machine); |
415 | f7c70325 | Paul Brook | qemu_register_machine(&realview_pbx_a9_machine); |
416 | f80f9ec9 | Anthony Liguori | } |
417 | f80f9ec9 | Anthony Liguori | |
418 | f80f9ec9 | Anthony Liguori | machine_init(realview_machine_init); |