1 /* $NetBSD: sa11x0_irq.S,v 1.5 2003/03/31 19:52:35 chris Exp $ */
4 * Copyright (c) 1998 Mark Brinicombe.
5 * Copyright (c) 1998 Causality Limited
8 * This code is derived from software contributed to the NetBSD Foundation
9 * by IWAMOTO Toshihiro.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by Mark Brinicombe
22 * for the NetBSD Project.
23 * 4. The name of the company nor the name of the author may be used to
24 * endorse or promote products derived from this software without specific
25 * prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
28 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
31 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 #include <machine/asm.h>
43 #include <machine/armreg.h>
44 #include <machine/asmacros.h>
45 #include <arm/sa11x0/sa11x0_reg.h>
46 __FBSDID("$FreeBSD$");
48 .word _C_LABEL(current_intr_depth)
50 .globl _C_LABEL(saipic_base)
51 _C_LABEL(saipic_base):
56 .asciz "irq_entry %x %x\n"
63 * r6 - Address of current handler
64 * r7 - Pointer to handler pointer list
65 * r8 - Current IRQ requests.
66 * r9 - Used to count through possible IRQ bits.
67 * r10 - Base address of SAIP
71 sub lr, lr, #0x00000004 /* Adjust the lr */
73 PUSHFRAMEINSVC /* Push an interrupt frame */
75 /* Load r8 with the SAIPIC interrupt requests */
77 ldr r10, _C_LABEL(saipic_base)
78 ldr r8, [r10, #(SAIPIC_IP)] /* Load IRQ pending register */
81 ldr r2, [r10, #(SAIPIC_MR)]
87 * Note that we have entered the IRQ handler.
88 * We are in SVC mode so we cannot use the processor mode
89 * to determine if we are in an IRQ. Instead we will count the
90 * each time the interrupt handler is nested.
93 ldr r0, Lcurrent_intr_depth
100 bl _C_LABEL(arm_handler_execute)
105 ldr r2, [r10, #(SAIPIC_MR)]
109 /* Decrement the nest count */
110 ldr r0, Lcurrent_intr_depth
116 PULLFRAMEFROMSVCANDEXIT
123 ENTRY(sa11x0_activateirqs)
124 ldr r0, _C_LABEL(saipic_base)
126 str r1, [r0, #(SAIPIC_MR)]
130 .word _C_LABEL(intrcnt)
133 .global _C_LABEL(intrnames), _C_LABEL(eintrnames)
134 .global _C_LABEL(eintrcnt)
136 _C_LABEL(eintrnames):
139 .globl _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
142 .space ICU_LEN*4 /* XXX Should be linked to number of interrupts */