2 * ARM RealView Emulation Baseboard Interrupt Controller
4 * Copyright (c) 2006-2007 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licensed under the GPL.
14 /* Only a single "CPU" interface is present. */
16 gic_get_current_cpu(void)
25 MemoryRegion container;
28 static void realview_gic_map_setup(RealViewGICState *s)
30 memory_region_init(&s->container, "realview-gic-container", 0x2000);
31 memory_region_add_subregion(&s->container, 0, &s->gic.cpuiomem[0]);
32 memory_region_add_subregion(&s->container, 0x1000, &s->gic.iomem);
35 static int realview_gic_init(SysBusDevice *dev)
37 RealViewGICState *s = FROM_SYSBUSGIC(RealViewGICState, dev);
39 /* The GICs on the RealView boards have a fixed nonconfigurable
40 * number of interrupt lines, so we don't need to expose this as
43 gic_init(&s->gic, 96);
44 realview_gic_map_setup(s);
45 sysbus_init_mmio(dev, &s->container);
49 static void realview_gic_class_init(ObjectClass *klass, void *data)
51 SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
53 sdc->init = realview_gic_init;
56 static TypeInfo realview_gic_info = {
57 .name = "realview_gic",
58 .parent = TYPE_SYS_BUS_DEVICE,
59 .instance_size = sizeof(RealViewGICState),
60 .class_init = realview_gic_class_init,
63 static void realview_gic_register_types(void)
65 type_register_static(&realview_gic_info);
68 type_init(realview_gic_register_types)