Statistics
| Branch: | Revision:

root / hw / syborg.c @ 4af39611

History | View | Annotate | Download (3.3 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

    
30
static struct arm_boot_info syborg_binfo;
31

    
32
static void syborg_init(ram_addr_t ram_size,
33
                        const char *boot_device,
34
                        const char *kernel_filename, const char *kernel_cmdline,
35
                        const char *initrd_filename, const char *cpu_model)
36
{
37
    CPUState *env;
38
    qemu_irq *cpu_pic;
39
    qemu_irq pic[64];
40
    ram_addr_t ram_addr;
41
    DeviceState *dev;
42
    int i;
43

    
44
    if (!cpu_model)
45
        cpu_model = "cortex-a8";
46
    env = cpu_init(cpu_model);
47
    if (!env) {
48
        fprintf(stderr, "Unable to find CPU definition\n");
49
        exit(1);
50
    }
51

    
52
    /* RAM at address zero. */
53
    ram_addr = qemu_ram_alloc(ram_size);
54
    cpu_register_physical_memory(0, ram_size, ram_addr | IO_MEM_RAM);
55

    
56
    cpu_pic = arm_pic_init_cpu(env);
57
    dev = sysbus_create_simple("syborg,interrupt", 0xC0000000,
58
                               cpu_pic[ARM_PIC_CPU_IRQ]);
59
    for (i = 0; i < 64; i++) {
60
        pic[i] = qdev_get_irq_sink(dev, i);
61
    }
62

    
63
    sysbus_create_simple("syborg,rtc", 0xC0001000, NULL);
64

    
65
    dev = qdev_create(NULL, "syborg,timer");
66
    qdev_set_prop_int(dev, "frequency", 1000000);
67
    qdev_init(dev);
68
    sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0xC0002000);
69
    sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[1]);
70

    
71
    sysbus_create_simple("syborg,keyboard", 0xC0003000, pic[2]);
72
    sysbus_create_simple("syborg,pointer", 0xC0004000, pic[3]);
73
    sysbus_create_simple("syborg,framebuffer", 0xC0005000, pic[4]);
74
    sysbus_create_simple("syborg,serial", 0xC0006000, pic[5]);
75
    sysbus_create_simple("syborg,serial", 0xC0007000, pic[6]);
76
    sysbus_create_simple("syborg,serial", 0xC0008000, pic[7]);
77
    sysbus_create_simple("syborg,serial", 0xC0009000, pic[8]);
78

    
79
    syborg_binfo.ram_size = ram_size;
80
    syborg_binfo.kernel_filename = kernel_filename;
81
    syborg_binfo.kernel_cmdline = kernel_cmdline;
82
    syborg_binfo.initrd_filename = initrd_filename;
83
    syborg_binfo.board_id = 0;
84
    arm_load_kernel(env, &syborg_binfo);
85
}
86

    
87
QEMUMachine syborg_machine = {
88
    .name = "syborg",
89
    .desc = "Syborg (Symbian Virtual Platform)",
90
    .init = syborg_init,
91
};