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