root / hw / syborg.c @ 636aa70a
History | View | Annotate | Download (3.8 kB)
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" |
28 |
#include "sysemu.h" |
29 |
#include "net.h" |
30 |
|
31 |
static struct arm_boot_info syborg_binfo; |
32 |
|
33 |
static void syborg_init(ram_addr_t ram_size, |
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; |
39 |
qemu_irq *cpu_pic; |
40 |
qemu_irq pic[64];
|
41 |
ram_addr_t ram_addr; |
42 |
DeviceState *dev; |
43 |
int i;
|
44 |
|
45 |
if (!cpu_model)
|
46 |
cpu_model = "cortex-a8";
|
47 |
env = cpu_init(cpu_model); |
48 |
if (!env) {
|
49 |
fprintf(stderr, "Unable to find CPU definition\n");
|
50 |
exit(1);
|
51 |
} |
52 |
|
53 |
/* RAM at address zero. */
|
54 |
ram_addr = qemu_ram_alloc(ram_size); |
55 |
cpu_register_physical_memory(0, ram_size, ram_addr | IO_MEM_RAM);
|
56 |
|
57 |
cpu_pic = arm_pic_init_cpu(env); |
58 |
dev = sysbus_create_simple("syborg,interrupt", 0xC0000000, |
59 |
cpu_pic[ARM_PIC_CPU_IRQ]); |
60 |
for (i = 0; i < 64; i++) { |
61 |
pic[i] = qdev_get_gpio_in(dev, i); |
62 |
} |
63 |
|
64 |
sysbus_create_simple("syborg,rtc", 0xC0001000, NULL); |
65 |
|
66 |
dev = qdev_create(NULL, "syborg,timer"); |
67 |
qdev_prop_set_uint32(dev, "frequency", 1000000); |
68 |
qdev_init(dev); |
69 |
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0xC0002000); |
70 |
sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[1]); |
71 |
|
72 |
sysbus_create_simple("syborg,keyboard", 0xC0003000, pic[2]); |
73 |
sysbus_create_simple("syborg,pointer", 0xC0004000, pic[3]); |
74 |
sysbus_create_simple("syborg,framebuffer", 0xC0005000, pic[4]); |
75 |
sysbus_create_simple("syborg,serial", 0xC0006000, pic[5]); |
76 |
sysbus_create_simple("syborg,serial", 0xC0007000, pic[6]); |
77 |
sysbus_create_simple("syborg,serial", 0xC0008000, pic[7]); |
78 |
sysbus_create_simple("syborg,serial", 0xC0009000, pic[8]); |
79 |
|
80 |
if (nd_table[0].vlan) { |
81 |
DeviceState *dev; |
82 |
SysBusDevice *s; |
83 |
|
84 |
qemu_check_nic_model(&nd_table[0], "virtio"); |
85 |
dev = qdev_create(NULL, "syborg,virtio-net"); |
86 |
dev->nd = &nd_table[0];
|
87 |
qdev_init(dev); |
88 |
s = sysbus_from_qdev(dev); |
89 |
sysbus_mmio_map(s, 0, 0xc000c000); |
90 |
sysbus_connect_irq(s, 0, pic[9]); |
91 |
} |
92 |
|
93 |
syborg_binfo.ram_size = ram_size; |
94 |
syborg_binfo.kernel_filename = kernel_filename; |
95 |
syborg_binfo.kernel_cmdline = kernel_cmdline; |
96 |
syborg_binfo.initrd_filename = initrd_filename; |
97 |
syborg_binfo.board_id = 0;
|
98 |
arm_load_kernel(env, &syborg_binfo); |
99 |
} |
100 |
|
101 |
static QEMUMachine syborg_machine = {
|
102 |
.name = "syborg",
|
103 |
.desc = "Syborg (Symbian Virtual Platform)",
|
104 |
.init = syborg_init, |
105 |
}; |
106 |
|
107 |
static void syborg_machine_init(void) |
108 |
{ |
109 |
qemu_register_machine(&syborg_machine); |
110 |
} |
111 |
|
112 |
machine_init(syborg_machine_init); |