ARM: mach-shmobile: Split out entry-macros in to GIC and INTC variants.
[pandora-kernel.git] / arch / arm / mach-shmobile / include / mach / entry-macro-gic.S
1 /*
2  * Copyright (C) 2010 Renesas Solutions Corp.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16  */
17 #include <mach/hardware.h>
18 #include <asm/hardware/gic.h>
19
20         .macro  disable_fiq
21         .endm
22
23         .macro  get_irqnr_preamble, base, tmp
24         ldr     \base, =(0xf0000100)
25         .endm
26
27         .macro  arch_ret_to_user, tmp1, tmp2
28         .endm
29
30         /*
31          * The interrupt numbering scheme is defined in the
32          * interrupt controller spec.  To wit:
33          *
34          * Interrupts 0-15 are IPI
35          * 16-28 are reserved
36          * 29-31 are local.  We allow 30 to be used for the watchdog.
37          * 32-1020 are global
38          * 1021-1022 are reserved
39          * 1023 is "spurious" (no interrupt)
40          *
41          * For now, we ignore all local interrupts so only return an
42          * interrupt if it's between 30 and 1020.  The test_for_ipi
43          * routine below will pick up on IPIs.
44          *
45          * A simple read from the controller will tell us the number of
46          * the highest priority enabled interrupt.  We then just need to
47          * check whether it is in the valid range for an IRQ (30-1020
48          * inclusive).
49          */
50
51         .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
52
53         ldr     \irqstat, [\base, #GIC_CPU_INTACK]
54         /* bits 12-10 = src CPU, 9-0 = int # */
55
56         ldr     \tmp, =1021
57         bic     \irqnr, \irqstat, #0x1c00
58         cmp     \irqnr, #29
59         cmpcc   \irqnr, \irqnr
60         cmpne   \irqnr, \tmp
61         cmpcs   \irqnr, \irqnr
62
63         .endm
64
65         /*
66          * We assume that irqstat (the raw value of the IRQ acknowledge
67          * register) is preserved from the macro above.
68          * If there is an IPI, we immediately signal end of interrupt on the
69          * controller, since this requires the original irqstat value which
70          * we won't easily be able to recreate later.
71          */
72
73         .macro test_for_ipi, irqnr, irqstat, base, tmp
74         bic     \irqnr, \irqstat, #0x1c00
75         cmp     \irqnr, #16
76         strcc   \irqstat, [\base, #GIC_CPU_EOI]
77         cmpcs   \irqnr, \irqnr
78         .endm
79
80         /* As above, this assumes that irqstat and base are preserved.. */
81
82         .macro test_for_ltirq, irqnr, irqstat, base, tmp
83         bic     \irqnr, \irqstat, #0x1c00
84         mov     \tmp, #0
85         cmp     \irqnr, #29
86         moveq   \tmp, #1
87         streq   \irqstat, [\base, #GIC_CPU_EOI]
88         cmp     \tmp, #0
89         .endm