]> Git Repo - qemu.git/blob - hw/realview_gic.c
hw/realview_gic: Use GIC memory region for the CPU interface
[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 #define GIC_NIRQ 96
13 #define NCPU 1
14
15 /* Only a single "CPU" interface is present.  */
16 static inline int
17 gic_get_current_cpu(void)
18 {
19   return 0;
20 }
21
22 #include "arm_gic.c"
23
24 typedef struct {
25     gic_state gic;
26     MemoryRegion container;
27 } RealViewGICState;
28
29 static void realview_gic_map_setup(RealViewGICState *s)
30 {
31     memory_region_init(&s->container, "realview-gic-container", 0x2000);
32     memory_region_add_subregion(&s->container, 0, &s->gic.cpuiomem[0]);
33     memory_region_add_subregion(&s->container, 0x1000, &s->gic.iomem);
34 }
35
36 static int realview_gic_init(SysBusDevice *dev)
37 {
38     RealViewGICState *s = FROM_SYSBUSGIC(RealViewGICState, dev);
39
40     gic_init(&s->gic);
41     realview_gic_map_setup(s);
42     sysbus_init_mmio(dev, &s->container);
43     return 0;
44 }
45
46 static void realview_gic_register_devices(void)
47 {
48     sysbus_register_dev("realview_gic", sizeof(RealViewGICState),
49                         realview_gic_init);
50 }
51
52 device_init(realview_gic_register_devices)
This page took 0.029608 seconds and 4 git commands to generate.