]>
Commit | Line | Data |
---|---|---|
4af39611 PB |
1 | /* |
2 | * Syborg (Symbian Virtual Platform) reference board | |
3 | * | |
4 | * Copyright (c) 2009 CodeSourcery | |
5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | * of this software and associated documentation files (the "Software"), to deal | |
8 | * in the Software without restriction, including without limitation the rights | |
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | * copies of the Software, and to permit persons to whom the Software is | |
11 | * furnished to do so, subject to the following conditions: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | |
15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | * THE SOFTWARE. | |
23 | */ | |
24 | ||
25 | #include "sysbus.h" | |
26 | #include "boards.h" | |
27 | #include "arm-misc.h" | |
340d96e7 | 28 | #include "net.h" |
9f7adc31 | 29 | #include "exec-memory.h" |
4af39611 PB |
30 | |
31 | static struct arm_boot_info syborg_binfo; | |
32 | ||
c227f099 | 33 | static void syborg_init(ram_addr_t ram_size, |
4af39611 PB |
34 | const char *boot_device, |
35 | const char *kernel_filename, const char *kernel_cmdline, | |
36 | const char *initrd_filename, const char *cpu_model) | |
37 | { | |
38 | CPUState *env; | |
9f7adc31 AK |
39 | MemoryRegion *sysmem = get_system_memory(); |
40 | MemoryRegion *ram = g_new(MemoryRegion, 1); | |
4af39611 PB |
41 | qemu_irq *cpu_pic; |
42 | qemu_irq pic[64]; | |
4af39611 PB |
43 | DeviceState *dev; |
44 | int i; | |
45 | ||
46 | if (!cpu_model) | |
47 | cpu_model = "cortex-a8"; | |
48 | env = cpu_init(cpu_model); | |
49 | if (!env) { | |
50 | fprintf(stderr, "Unable to find CPU definition\n"); | |
51 | exit(1); | |
52 | } | |
53 | ||
54 | /* RAM at address zero. */ | |
9f7adc31 AK |
55 | memory_region_init_ram(ram, NULL, "syborg.ram", ram_size); |
56 | memory_region_add_subregion(sysmem, 0, ram); | |
4af39611 PB |
57 | |
58 | cpu_pic = arm_pic_init_cpu(env); | |
59 | dev = sysbus_create_simple("syborg,interrupt", 0xC0000000, | |
60 | cpu_pic[ARM_PIC_CPU_IRQ]); | |
61 | for (i = 0; i < 64; i++) { | |
067a3ddc | 62 | pic[i] = qdev_get_gpio_in(dev, i); |
4af39611 PB |
63 | } |
64 | ||
65 | sysbus_create_simple("syborg,rtc", 0xC0001000, NULL); | |
66 | ||
67 | dev = qdev_create(NULL, "syborg,timer"); | |
ee6847d1 | 68 | qdev_prop_set_uint32(dev, "frequency", 1000000); |
e23a1b33 | 69 | qdev_init_nofail(dev); |
4af39611 PB |
70 | sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0xC0002000); |
71 | sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[1]); | |
72 | ||
73 | sysbus_create_simple("syborg,keyboard", 0xC0003000, pic[2]); | |
74 | sysbus_create_simple("syborg,pointer", 0xC0004000, pic[3]); | |
75 | sysbus_create_simple("syborg,framebuffer", 0xC0005000, pic[4]); | |
76 | sysbus_create_simple("syborg,serial", 0xC0006000, pic[5]); | |
77 | sysbus_create_simple("syborg,serial", 0xC0007000, pic[6]); | |
78 | sysbus_create_simple("syborg,serial", 0xC0008000, pic[7]); | |
79 | sysbus_create_simple("syborg,serial", 0xC0009000, pic[8]); | |
80 | ||
97b15621 | 81 | if (nd_table[0].vlan || nd_table[0].netdev) { |
340d96e7 PB |
82 | DeviceState *dev; |
83 | SysBusDevice *s; | |
84 | ||
85 | qemu_check_nic_model(&nd_table[0], "virtio"); | |
86 | dev = qdev_create(NULL, "syborg,virtio-net"); | |
97b15621 | 87 | qdev_set_nic_properties(dev, &nd_table[0]); |
e23a1b33 | 88 | qdev_init_nofail(dev); |
340d96e7 PB |
89 | s = sysbus_from_qdev(dev); |
90 | sysbus_mmio_map(s, 0, 0xc000c000); | |
91 | sysbus_connect_irq(s, 0, pic[9]); | |
92 | } | |
93 | ||
4af39611 PB |
94 | syborg_binfo.ram_size = ram_size; |
95 | syborg_binfo.kernel_filename = kernel_filename; | |
96 | syborg_binfo.kernel_cmdline = kernel_cmdline; | |
97 | syborg_binfo.initrd_filename = initrd_filename; | |
98 | syborg_binfo.board_id = 0; | |
99 | arm_load_kernel(env, &syborg_binfo); | |
100 | } | |
101 | ||
f80f9ec9 | 102 | static QEMUMachine syborg_machine = { |
4af39611 PB |
103 | .name = "syborg", |
104 | .desc = "Syborg (Symbian Virtual Platform)", | |
105 | .init = syborg_init, | |
106 | }; | |
f80f9ec9 AL |
107 | |
108 | static void syborg_machine_init(void) | |
109 | { | |
110 | qemu_register_machine(&syborg_machine); | |
111 | } | |
112 | ||
113 | machine_init(syborg_machine_init); |