Merge branch 'virtio' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux...
[pandora-kernel.git] / arch / arm / mach-vexpress / include / mach / entry-macro.S
1 #include <asm/hardware/gic.h>
2
3         .macro  disable_fiq
4         .endm
5
6         .macro  get_irqnr_preamble, base, tmp
7         ldr     \base, =gic_cpu_base_addr
8         ldr     \base, [\base]
9         .endm
10
11         .macro  arch_ret_to_user, tmp1, tmp2
12         .endm
13
14         /*
15          * The interrupt numbering scheme is defined in the
16          * interrupt controller spec.  To wit:
17          *
18          * Interrupts 0-15 are IPI
19          * 16-28 are reserved
20          * 29-31 are local.  We allow 30 to be used for the watchdog.
21          * 32-1020 are global
22          * 1021-1022 are reserved
23          * 1023 is "spurious" (no interrupt)
24          *
25          * For now, we ignore all local interrupts so only return an interrupt if it's
26          * between 30 and 1020.  The test_for_ipi routine below will pick up on IPIs.
27          *
28          * A simple read from the controller will tell us the number of the highest
29          * priority enabled interrupt.  We then just need to check whether it is in the
30          * valid range for an IRQ (30-1020 inclusive).
31          */
32
33         .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
34         ldr     \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */
35         ldr     \tmp, =1021
36         bic     \irqnr, \irqstat, #0x1c00
37         cmp     \irqnr, #29
38         cmpcc   \irqnr, \irqnr
39         cmpne   \irqnr, \tmp
40         cmpcs   \irqnr, \irqnr
41         .endm
42
43         /* We assume that irqstat (the raw value of the IRQ acknowledge
44          * register) is preserved from the macro above.
45          * If there is an IPI, we immediately signal end of interrupt on the
46          * controller, since this requires the original irqstat value which
47          * we won't easily be able to recreate later.
48          */
49
50         .macro test_for_ipi, irqnr, irqstat, base, tmp
51         bic     \irqnr, \irqstat, #0x1c00
52         cmp     \irqnr, #16
53         strcc   \irqstat, [\base, #GIC_CPU_EOI]
54         cmpcs   \irqnr, \irqnr
55         .endm
56
57         /* As above, this assumes that irqstat and base are preserved.. */
58
59         .macro test_for_ltirq, irqnr, irqstat, base, tmp
60         bic     \irqnr, \irqstat, #0x1c00
61         mov     \tmp, #0
62         cmp     \irqnr, #29
63         moveq   \tmp, #1
64         streq   \irqstat, [\base, #GIC_CPU_EOI]
65         cmp     \tmp, #0
66         .endm
67