]> Git Repo - qemu.git/blob - hw/realview_gic.c
hw/arm_gic: Move NCPU definition to arm_gic.c
[qemu.git] / hw / realview_gic.c
1 /*
2  * ARM RealView Emulation Baseboard Interrupt Controller
3  *
4  * Copyright (c) 2006-2007 CodeSourcery.
5  * Written by Paul Brook
6  *
7  * This code is licensed under the GPL.
8  */
9
10 #include "sysbus.h"
11
12 /* Only a single "CPU" interface is present.  */
13 static inline int
14 gic_get_current_cpu(void)
15 {
16   return 0;
17 }
18
19 #include "arm_gic.c"
20
21 typedef struct {
22     gic_state gic;
23     MemoryRegion container;
24 } RealViewGICState;
25
26 static void realview_gic_map_setup(RealViewGICState *s)
27 {
28     memory_region_init(&s->container, "realview-gic-container", 0x2000);
29     memory_region_add_subregion(&s->container, 0, &s->gic.cpuiomem[0]);
30     memory_region_add_subregion(&s->container, 0x1000, &s->gic.iomem);
31 }
32
33 static int realview_gic_init(SysBusDevice *dev)
34 {
35     RealViewGICState *s = FROM_SYSBUSGIC(RealViewGICState, dev);
36
37     /* The GICs on the RealView boards have a fixed nonconfigurable
38      * number of interrupt lines, so we don't need to expose this as
39      * a qdev property.
40      */
41     gic_init(&s->gic, 1, 96);
42     realview_gic_map_setup(s);
43     sysbus_init_mmio(dev, &s->container);
44     return 0;
45 }
46
47 static void realview_gic_class_init(ObjectClass *klass, void *data)
48 {
49     SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
50
51     sdc->init = realview_gic_init;
52 }
53
54 static TypeInfo realview_gic_info = {
55     .name          = "realview_gic",
56     .parent        = TYPE_SYS_BUS_DEVICE,
57     .instance_size = sizeof(RealViewGICState),
58     .class_init    = realview_gic_class_init,
59 };
60
61 static void realview_gic_register_types(void)
62 {
63     type_register_static(&realview_gic_info);
64 }
65
66 type_init(realview_gic_register_types)
This page took 0.0292 seconds and 4 git commands to generate.