Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Uwe Zeisberger | f30c226 | 2006-10-03 23:01:26 +0200 | [diff] [blame] | 2 | * include/asm-arm/arch-clps711x/entry-macro.S |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Low-level IRQ helper macros for CLPS711X-based platforms |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. |
| 9 | */ |
Russell King | 78ff18a | 2006-01-03 17:39:34 +0000 | [diff] [blame] | 10 | #include <asm/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <asm/hardware/clps7111.h> |
| 12 | |
| 13 | .macro disable_fiq |
| 14 | .endm |
| 15 | |
Dan Williams | f80dff9 | 2007-02-16 22:16:32 +0100 | [diff] [blame] | 16 | .macro get_irqnr_preamble, base, tmp |
| 17 | .endm |
| 18 | |
| 19 | .macro arch_ret_to_user, tmp1, tmp2 |
| 20 | .endm |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #if (INTSR2 - INTSR1) != (INTMR2 - INTMR1) |
| 23 | #error INTSR stride != INTMR stride |
| 24 | #endif |
| 25 | |
| 26 | .macro get_irqnr_and_base, irqnr, stat, base, mask |
| 27 | mov \base, #CLPS7111_BASE |
| 28 | ldr \stat, [\base, #INTSR1] |
| 29 | ldr \mask, [\base, #INTMR1] |
| 30 | mov \irqnr, #4 |
| 31 | mov \mask, \mask, lsl #16 |
| 32 | and \stat, \stat, \mask, lsr #16 |
| 33 | movs \stat, \stat, lsr #4 |
| 34 | bne 1001f |
| 35 | |
| 36 | add \base, \base, #INTSR2 - INTSR1 |
| 37 | ldr \stat, [\base, #INTSR1] |
| 38 | ldr \mask, [\base, #INTMR1] |
| 39 | mov \irqnr, #16 |
| 40 | mov \mask, \mask, lsl #16 |
| 41 | and \stat, \stat, \mask, lsr #16 |
| 42 | |
| 43 | 1001: tst \stat, #255 |
| 44 | addeq \irqnr, \irqnr, #8 |
| 45 | moveq \stat, \stat, lsr #8 |
| 46 | tst \stat, #15 |
| 47 | addeq \irqnr, \irqnr, #4 |
| 48 | moveq \stat, \stat, lsr #4 |
| 49 | tst \stat, #3 |
| 50 | addeq \irqnr, \irqnr, #2 |
| 51 | moveq \stat, \stat, lsr #2 |
| 52 | tst \stat, #1 |
| 53 | addeq \irqnr, \irqnr, #1 |
| 54 | moveq \stat, \stat, lsr #1 |
| 55 | tst \stat, #1 @ bit 0 should be set |
| 56 | .endm |
| 57 | |
| 58 | |