]>
Commit | Line | Data |
---|---|---|
9ee6e8bb PB |
1 | /* |
2 | * ARM RealView Emulation Baseboard Interrupt Controller | |
3 | * | |
4 | * Copyright (c) 2006-2007 CodeSourcery. | |
5 | * Written by Paul Brook | |
6 | * | |
8e31bf38 | 7 | * This code is licensed under the GPL. |
9ee6e8bb PB |
8 | */ |
9 | ||
fe7e8758 | 10 | #include "sysbus.h" |
9ee6e8bb PB |
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 | ||
fe7e8758 PB |
24 | typedef struct { |
25 | gic_state gic; | |
755c0802 | 26 | MemoryRegion container; |
fe7e8758 PB |
27 | } RealViewGICState; |
28 | ||
755c0802 | 29 | static void realview_gic_map_setup(RealViewGICState *s) |
9ee6e8bb | 30 | { |
755c0802 | 31 | memory_region_init(&s->container, "realview-gic-container", 0x2000); |
c3ffa595 | 32 | memory_region_add_subregion(&s->container, 0, &s->gic.cpuiomem[0]); |
755c0802 | 33 | memory_region_add_subregion(&s->container, 0x1000, &s->gic.iomem); |
fe7e8758 PB |
34 | } |
35 | ||
81a322d4 | 36 | static int realview_gic_init(SysBusDevice *dev) |
fe7e8758 PB |
37 | { |
38 | RealViewGICState *s = FROM_SYSBUSGIC(RealViewGICState, dev); | |
9ee6e8bb | 39 | |
fe7e8758 | 40 | gic_init(&s->gic); |
755c0802 | 41 | realview_gic_map_setup(s); |
750ecd44 | 42 | sysbus_init_mmio(dev, &s->container); |
81a322d4 | 43 | return 0; |
9ee6e8bb | 44 | } |
fe7e8758 PB |
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) |