Path: blob/master/arch/arm/mach-msm/include/mach/entry-macro-qgic.S
17686 views
/*1* Low-level IRQ helper macros2*3* Copyright (c) 2010, Code Aurora Forum. All rights reserved.4*5* This file is licensed under the terms of the GNU General Public6* License version 2. This program is licensed "as is" without any7* warranty of any kind, whether express or implied.8*/910#include <mach/hardware.h>11#include <asm/hardware/gic.h>1213.macro disable_fiq14.endm1516.macro get_irqnr_preamble, base, tmp17ldr \base, =gic_cpu_base_addr18ldr \base, [\base]19.endm2021.macro arch_ret_to_user, tmp1, tmp222.endm2324/*25* The interrupt numbering scheme is defined in the26* interrupt controller spec. To wit:27*28* Migrated the code from ARM MP port to be more consistent29* with interrupt processing , the following still holds true30* however, all interrupts are treated the same regardless of31* if they are local IPI or PPI32*33* Interrupts 0-15 are IPI34* 16-31 are PPI35* (16-18 are the timers)36* 32-1020 are global37* 1021-1022 are reserved38* 1023 is "spurious" (no interrupt)39*40* A simple read from the controller will tell us the number of the41* highest priority enabled interrupt. We then just need to check42* whether it is in the valid range for an IRQ (0-1020 inclusive).43*44* Base ARM code assumes that the local (private) peripheral interrupts45* are not valid, we treat them differently, in that the privates are46* handled like normal shared interrupts with the exception that only47* one processor can register the interrupt and the handler must be48* the same for all processors.49*/5051.macro get_irqnr_and_base, irqnr, irqstat, base, tmp5253ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 =srcCPU,549-0 =int # */5556bic \irqnr, \irqstat, #0x1c00 @mask src57cmp \irqnr, #1558ldr \tmp, =102159cmpcc \irqnr, \irqnr60cmpne \irqnr, \tmp61cmpcs \irqnr, \irqnr6263.endm6465/* We assume that irqstat (the raw value of the IRQ acknowledge66* register) is preserved from the macro above.67* If there is an IPI, we immediately signal end of interrupt on the68* controller, since this requires the original irqstat value which69* we won't easily be able to recreate later.70*/71.macro test_for_ipi, irqnr, irqstat, base, tmp72bic \irqnr, \irqstat, #0x1c0073cmp \irqnr, #1674strcc \irqstat, [\base, #GIC_CPU_EOI]75cmpcs \irqnr, \irqnr76.endm7778/* As above, this assumes that irqstat and base are preserved.. */7980.macro test_for_ltirq, irqnr, irqstat, base, tmp81bic \irqnr, \irqstat, #0x1c0082mov \tmp, #083cmp \irqnr, #1684moveq \tmp, #185streq \irqstat, [\base, #GIC_CPU_EOI]86cmp \tmp, #087.endm888990