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.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <machine/asm.h>
36 #include <machine/armreg.h>
37 #include <machine/asmacros.h>
38 #include <arm/sa11x0/sa11x0_reg.h>
39 __FBSDID("$FreeBSD$");
41 .word _C_LABEL(current_intr_depth)
43 .globl _C_LABEL(saipic_base)
44 _C_LABEL(saipic_base):
49 .asciz "irq_entry %x %x\n"
56 * r6 - Address of current handler
57 * r7 - Pointer to handler pointer list
58 * r8 - Current IRQ requests.
59 * r9 - Used to count through possible IRQ bits.
60 * r10 - Base address of SAIP
64 sub lr, lr, #0x00000004 /* Adjust the lr */
66 PUSHFRAMEINSVC /* Push an interrupt frame */
68 /* Load r8 with the SAIPIC interrupt requests */
70 ldr r10, _C_LABEL(saipic_base)
71 ldr r8, [r10, #(SAIPIC_IP)] /* Load IRQ pending register */
74 ldr r2, [r10, #(SAIPIC_MR)]
80 * Note that we have entered the IRQ handler.
81 * We are in SVC mode so we cannot use the processor mode
82 * to determine if we are in an IRQ. Instead we will count the
83 * each time the interrupt handler is nested.
86 ldr r0, Lcurrent_intr_depth
93 bl _C_LABEL(arm_handler_execute)
98 ldr r2, [r10, #(SAIPIC_MR)]
102 /* Decrement the nest count */
103 ldr r0, Lcurrent_intr_depth
109 PULLFRAMEFROMSVCANDEXIT
116 ENTRY(sa11x0_activateirqs)
117 ldr r0, _C_LABEL(saipic_base)
119 str r1, [r0, #(SAIPIC_MR)]
122 .global _C_LABEL(intrnames), _C_LABEL(sintrnames)
124 _C_LABEL(sintrnames):
127 .globl _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
130 .space ICU_LEN*4 /* XXX Should be linked to number of interrupts */