1 /* arch/arm/mach-tegra/include/mach/entry-macro.S
3 * Copyright (C) 2009 Palm, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <mach/iomap.h>
18 #if defined(CONFIG_ARM_GIC)
20 #include <asm/hardware/gic.h>
22 /* Uses the GIC interrupt controller built into the cpu */
23 #define ICTRL_BASE (IO_CPU_VIRT + 0x100)
28 .macro get_irqnr_preamble, base, tmp
29 movw \base, #(ICTRL_BASE & 0x0000ffff)
30 movt \base, #((ICTRL_BASE & 0xffff0000) >> 16)
33 .macro arch_ret_to_user, tmp1, tmp2
37 * The interrupt numbering scheme is defined in the
38 * interrupt controller spec. To wit:
40 * Interrupts 0-15 are IPI
42 * 29-31 are local. We allow 30 to be used for the watchdog.
44 * 1021-1022 are reserved
45 * 1023 is "spurious" (no interrupt)
47 * For now, we ignore all local interrupts so only return an interrupt
48 * if it's between 30 and 1020. The test_for_ipi routine below will
51 * A simple read from the controller will tell us the number of the
52 * highest priority enabled interrupt. We then just need to check
53 * whether it is in the valid range for an IRQ (30-1020 inclusive).
56 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
58 /* bits 12-10 = src CPU, 9-0 = int # */
59 ldr \irqstat, [\base, #GIC_CPU_INTACK]
63 bic \irqnr, \irqstat, #0x1c00
72 /* We assume that irqstat (the raw value of the IRQ acknowledge
73 * register) is preserved from the macro above.
74 * If there is an IPI, we immediately signal end of interrupt on the
75 * controller, since this requires the original irqstat value which
76 * we won't easily be able to recreate later.
79 .macro test_for_ipi, irqnr, irqstat, base, tmp
80 bic \irqnr, \irqstat, #0x1c00
82 strcc \irqstat, [\base, #GIC_CPU_EOI]
86 /* As above, this assumes that irqstat and base are preserved.. */
88 .macro test_for_ltirq, irqnr, irqstat, base, tmp
89 bic \irqnr, \irqstat, #0x1c00
93 streq \irqstat, [\base, #GIC_CPU_EOI]
98 /* legacy interrupt controller for AP16 */
102 .macro get_irqnr_preamble, base, tmp
103 @ enable imprecise aborts
105 @ EVP base at 0xf010f000
106 mov \base, #0xf0000000
107 orr \base, #0x00100000
108 orr \base, #0x0000f000
111 .macro arch_ret_to_user, tmp1, tmp2
114 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
115 ldr \irqnr, [\base, #0x20] @ EVT_IRQ_STS