Fix some compiler warnings related to format strings
[qemu/ar7.git] / hw / arm / syborg.c
blob116c5ca6d03cde5de3f83050c38e6b685a180b52
1 /*
2 * Syborg (Symbian Virtual Platform) reference board
4 * Copyright (c) 2009 CodeSourcery
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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.
25 #include "qemu/osdep.h"
26 #include "cpu.h"
27 #include "hw/sysbus.h"
28 #include "hw/boards.h"
29 #include "hw/arm/arm.h"
30 #include "exec/address-spaces.h"
31 #include "net/net.h"
33 static struct arm_boot_info syborg_binfo;
35 static void syborg_init(MachineState *machine)
37 ARMCPU *cpu;
38 MemoryRegion *sysmem = get_system_memory();
39 MemoryRegion *ram = g_new(MemoryRegion, 1);
40 qemu_irq pic[64];
41 DeviceState *dev;
42 int i;
44 if (!machine->cpu_model) {
45 machine->cpu_model = "cortex-a8";
47 cpu = ARM_CPU(cpu_generic_init(TYPE_ARM_CPU, machine->cpu_model));
49 /* RAM at address zero. */
50 memory_region_allocate_system_memory(ram, NULL, "syborg.ram", machine->ram_size);
51 memory_region_add_subregion(sysmem, 0, ram);
53 dev = sysbus_create_simple("syborg,interrupt", 0xC0000000,
54 qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
55 for (i = 0; i < 64; i++) {
56 pic[i] = qdev_get_gpio_in(dev, i);
59 sysbus_create_simple("syborg,rtc", 0xC0001000, NULL);
61 dev = qdev_create(NULL, "syborg,timer");
62 qdev_prop_set_uint32(dev, "frequency", 1000000);
63 qdev_init_nofail(dev);
64 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xC0002000);
65 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[1]);
67 sysbus_create_simple("syborg,keyboard", 0xC0003000, pic[2]);
68 sysbus_create_simple("syborg,pointer", 0xC0004000, pic[3]);
69 sysbus_create_simple("syborg,framebuffer", 0xC0005000, pic[4]);
70 sysbus_create_simple("syborg,serial", 0xC0006000, pic[5]);
71 sysbus_create_simple("syborg,serial", 0xC0007000, pic[6]);
72 sysbus_create_simple("syborg,serial", 0xC0008000, pic[7]);
73 sysbus_create_simple("syborg,serial", 0xC0009000, pic[8]);
75 if (nd_table[0].used || nd_table[0].netdev) {
76 DeviceState *dev;
77 SysBusDevice *s;
79 qemu_check_nic_model(&nd_table[0], "virtio");
80 dev = qdev_create(NULL, "syborg,virtio-net");
81 qdev_set_nic_properties(dev, &nd_table[0]);
82 qdev_init_nofail(dev);
83 s = SYS_BUS_DEVICE(dev);
84 sysbus_mmio_map(s, 0, 0xc000c000);
85 sysbus_connect_irq(s, 0, pic[9]);
88 syborg_binfo.ram_size = machine->ram_size;
89 syborg_binfo.kernel_filename = machine->kernel_filename;
90 syborg_binfo.kernel_cmdline = machine->kernel_cmdline;
91 syborg_binfo.initrd_filename = machine->initrd_filename;
92 syborg_binfo.board_id = 0;
93 arm_load_kernel(cpu, &syborg_binfo);
96 static void syborg_machine_init(MachineClass *mc)
98 mc->desc = "Syborg (Symbian Virtual Platform)";
99 mc->init = syborg_init;
102 DEFINE_MACHINE("syborg", syborg_machine_init)