RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / include / asm-arm / arch-realview / entry-macro.S
blob3b4e2076603a5e23eb97f68f20c307ffd2d7384e
1 /*
2  * include/asm-arm/arch-realview/entry-macro.S
3  *
4  * Low-level IRQ helper macros for RealView platforms
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 #include <asm/hardware.h>
11 #include <asm/hardware/gic.h>
13                 .macro  disable_fiq
14                 .endm
16                 .macro  get_irqnr_preamble, base, tmp
17                 ldr     \base, =IO_ADDRESS(REALVIEW_GIC_CPU_BASE)
18                 .endm
20                 .macro  arch_ret_to_user, tmp1, tmp2
21                 .endm
23                 /*
24                  * The interrupt numbering scheme is defined in the
25                  * interrupt controller spec.  To wit:
26                  *
27                  * Interrupts 0-15 are IPI
28                  * 16-28 are reserved
29                  * 29-31 are local.  We allow 30 to be used for the watchdog.
30                  * 32-1020 are global
31                  * 1021-1022 are reserved
32                  * 1023 is "spurious" (no interrupt)
33                  *
34                  * For now, we ignore all local interrupts so only return an interrupt if it's
35                  * between 30 and 1020.  The test_for_ipi routine below will pick up on IPIs.
36                  *
37                  * A simple read from the controller will tell us the number of the highest
38                  * priority enabled interrupt.  We then just need to check whether it is in the
39                  * valid range for an IRQ (30-1020 inclusive).
40                  */
42                 .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
44                 ldr     \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */
46                 ldr     \tmp, =1021
48                 bic     \irqnr, \irqstat, #0x1c00
50                 cmp     \irqnr, #29
51                 cmpcc   \irqnr, \irqnr
52                 cmpne   \irqnr, \tmp
53                 cmpcs   \irqnr, \irqnr
55                 .endm
57                 /* We assume that irqstat (the raw value of the IRQ acknowledge
58                  * register) is preserved from the macro above.
59                  * If there is an IPI, we immediately signal end of interrupt on the
60                  * controller, since this requires the original irqstat value which
61                  * we won't easily be able to recreate later.
62                  */
64                 .macro test_for_ipi, irqnr, irqstat, base, tmp
65                 bic     \irqnr, \irqstat, #0x1c00
66                 cmp     \irqnr, #16
67                 strcc   \irqstat, [\base, #GIC_CPU_EOI]
68                 cmpcs   \irqnr, \irqnr
69                 .endm
71                 /* As above, this assumes that irqstat and base are preserved.. */
73                 .macro test_for_ltirq, irqnr, irqstat, base, tmp
74                 bic     \irqnr, \irqstat, #0x1c00
75                 mov     \tmp, #0
76                 cmp     \irqnr, #29
77                 moveq   \tmp, #1
78                 streq   \irqstat, [\base, #GIC_CPU_EOI]
79                 cmp     \tmp, #0
80                 .endm