aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2010-11-15 18:48:07 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-12-07 04:20:24 -0500
commit161d1907607a5a562a152058c8daf1780ce7a00b (patch)
tree0166cebedcd66a0f34c1d7cfcb51106add5b1019 /arch
parentcf7d7e5a1980d1116ee152d25dac382b112b9c17 (diff)
ARM: 6475/1: Introduce asm/hardware/entry-macro-gic.S
This patch is the identical GIC demux implementation merge V3. Instead of implementing same code over and over simply share it in entry-macro-gic.S. The shared code is based on the realview implementation. Each GIC demux instance still has to setup the base address of the controller using the get_irqnr_preamble macro. The rest of the GIC specific code can be shared. Signed-off-by: Magnus Damm <damm@opensource.se> Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/hardware/entry-macro-gic.S68
1 files changed, 68 insertions, 0 deletions
diff --git a/arch/arm/include/asm/hardware/entry-macro-gic.S b/arch/arm/include/asm/hardware/entry-macro-gic.S
new file mode 100644
index 000000000000..05587f125a13
--- /dev/null
+++ b/arch/arm/include/asm/hardware/entry-macro-gic.S
@@ -0,0 +1,68 @@
1/*
2 * arch/arm/include/asm/hardware/entry-macro-gic.S
3 *
4 * Low-level IRQ helper macros for GIC
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <asm/hardware/gic.h>
12
13/*
14 * The interrupt numbering scheme is defined in the
15 * interrupt controller spec. To wit:
16 *
17 * Interrupts 0-15 are IPI
18 * 16-28 are reserved
19 * 29-31 are local. We allow 30 to be used for the watchdog.
20 * 32-1020 are global
21 * 1021-1022 are reserved
22 * 1023 is "spurious" (no interrupt)
23 *
24 * For now, we ignore all local interrupts so only return an interrupt if it's
25 * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs.
26 *
27 * A simple read from the controller will tell us the number of the highest
28 * priority enabled interrupt. We then just need to check whether it is in the
29 * valid range for an IRQ (30-1020 inclusive).
30 */
31
32 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
33
34 ldr \irqstat, [\base, #GIC_CPU_INTACK]
35 /* bits 12-10 = src CPU, 9-0 = int # */
36
37 ldr \tmp, =1021
38 bic \irqnr, \irqstat, #0x1c00
39 cmp \irqnr, #29
40 cmpcc \irqnr, \irqnr
41 cmpne \irqnr, \tmp
42 cmpcs \irqnr, \irqnr
43 .endm
44
45/* We assume that irqstat (the raw value of the IRQ acknowledge
46 * register) is preserved from the macro above.
47 * If there is an IPI, we immediately signal end of interrupt on the
48 * controller, since this requires the original irqstat value which
49 * we won't easily be able to recreate later.
50 */
51
52 .macro test_for_ipi, irqnr, irqstat, base, tmp
53 bic \irqnr, \irqstat, #0x1c00
54 cmp \irqnr, #16
55 strcc \irqstat, [\base, #GIC_CPU_EOI]
56 cmpcs \irqnr, \irqnr
57 .endm
58
59/* As above, this assumes that irqstat and base are preserved.. */
60
61 .macro test_for_ltirq, irqnr, irqstat, base, tmp
62 bic \irqnr, \irqstat, #0x1c00
63 mov \tmp, #0
64 cmp \irqnr, #29
65 moveq \tmp, #1
66 streq \irqstat, [\base, #GIC_CPU_EOI]
67 cmp \tmp, #0
68 .endm