gic.c 967 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright 2011 Freescale Semiconductor, Inc.
  3. * Copyright 2011 Linaro Ltd.
  4. *
  5. * The code contained herein is licensed under the GNU General Public
  6. * License. You may obtain a copy of the GNU General Public License
  7. * Version 2 or later at the following locations:
  8. *
  9. * http://www.opensource.org/licenses/gpl-license.html
  10. * http://www.gnu.org/copyleft/gpl.html
  11. */
  12. #include <linux/io.h>
  13. #include <asm/exception.h>
  14. #include <asm/localtimer.h>
  15. #include <asm/hardware/gic.h>
  16. #ifdef CONFIG_SMP
  17. #include <asm/smp.h>
  18. #endif
  19. asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
  20. {
  21. u32 irqstat, irqnr;
  22. do {
  23. irqstat = readl_relaxed(gic_cpu_base_addr + GIC_CPU_INTACK);
  24. irqnr = irqstat & 0x3ff;
  25. if (irqnr == 1023)
  26. break;
  27. if (irqnr > 15 && irqnr < 1021)
  28. handle_IRQ(irqnr, regs);
  29. #ifdef CONFIG_SMP
  30. else {
  31. writel_relaxed(irqstat, gic_cpu_base_addr +
  32. GIC_CPU_EOI);
  33. handle_IPI(irqnr, regs);
  34. }
  35. #endif
  36. } while (1);
  37. }