1/*
2 * arch/arm/include/asm/hardware/entry-macro-iomd.S
3 *
4 * Low-level IRQ helper macros for IOC/IOMD 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 */
10
11/* IOC / IOMD based hardware */
12#include <asm/hardware/iomd.h>
13
14		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
15		ldrb	\irqstat, [\base, #IOMD_IRQREQB]	@ get high priority first
16		ldr	\tmp, =irq_prio_h
17		teq	\irqstat, #0
18#ifdef IOMD_BASE
19		ldreqb	\irqstat, [\base, #IOMD_DMAREQ]	@ get dma
20		addeq	\tmp, \tmp, #256		@ irq_prio_h table size
21		teqeq	\irqstat, #0
22		bne	2406f
23#endif
24		ldreqb	\irqstat, [\base, #IOMD_IRQREQA]	@ get low priority
25		addeq	\tmp, \tmp, #256		@ irq_prio_d table size
26		teqeq	\irqstat, #0
27#ifdef IOMD_IRQREQC
28		ldreqb	\irqstat, [\base, #IOMD_IRQREQC]
29		addeq	\tmp, \tmp, #256		@ irq_prio_l table size
30		teqeq	\irqstat, #0
31#endif
32#ifdef IOMD_IRQREQD
33		ldreqb	\irqstat, [\base, #IOMD_IRQREQD]
34		addeq	\tmp, \tmp, #256		@ irq_prio_lc table size
35		teqeq	\irqstat, #0
36#endif
372406:		ldrneb	\irqnr, [\tmp, \irqstat]	@ get IRQ number
38		.endm
39
40/*
41 * Interrupt table (incorporates priority).  Please note that we
42 * rely on the order of these tables (see above code).
43 */
44		.align	5
45irq_prio_h:	.byte	 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
46		.byte	12, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
47		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
48		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
49		.byte	14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
50		.byte	14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
51		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
52		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
53		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
54		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
55		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
56		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
57		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
58		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
59		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
60		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
61#ifdef IOMD_BASE
62irq_prio_d:	.byte	 0,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
63		.byte	20,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
64		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
65		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
66		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
67		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
68		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
69		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
70		.byte	23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
71		.byte	23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
72		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
73		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
74		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
75		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
76		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
77		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
78#endif
79irq_prio_l:	.byte	 0, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
80		.byte	 4, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
81		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
82		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
83		.byte	 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
84		.byte	 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
85		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
86		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
87		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
88		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
89		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
90		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
91		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
92		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
93		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
94		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
95#ifdef IOMD_IRQREQC
96irq_prio_lc:	.byte	24,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
97		.byte	28,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
98		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
99		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
100		.byte	30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
101		.byte	30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
102		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
103		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
104		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
105		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
106		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
107		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
108		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
109		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
110		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
111		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
112#endif
113#ifdef IOMD_IRQREQD
114irq_prio_ld:	.byte	40,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
115		.byte	44,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
116		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
117		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
118		.byte	46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
119		.byte	46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
120		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
121		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
122		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
123		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
124		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
125		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
126		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
127		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
128		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
129		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
130#endif
131
132