Home | History | Annotate | Line # | Download | only in isa
isa_irq.S revision 1.3
      1  1.3      scw /*	$NetBSD: isa_irq.S,v 1.3 2003/11/05 12:03:58 scw Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*
      4  1.1  thorpej  * Copyright 1997
      5  1.1  thorpej  * Digital Equipment Corporation. All rights reserved.
      6  1.1  thorpej  *
      7  1.1  thorpej  * This software is furnished under license and may be used and
      8  1.1  thorpej  * copied only in accordance with the following terms and conditions.
      9  1.1  thorpej  * Subject to these conditions, you may download, copy, install,
     10  1.1  thorpej  * use, modify and distribute this software in source and/or binary
     11  1.1  thorpej  * form. No title or ownership is transferred hereby.
     12  1.1  thorpej  *
     13  1.1  thorpej  * 1) Any source code used, modified or distributed must reproduce
     14  1.1  thorpej  *    and retain this copyright notice and list of conditions as
     15  1.1  thorpej  *    they appear in the source file.
     16  1.1  thorpej  *
     17  1.1  thorpej  * 2) No right is granted to use any trade name, trademark, or logo of
     18  1.1  thorpej  *    Digital Equipment Corporation. Neither the "Digital Equipment
     19  1.1  thorpej  *    Corporation" name nor any trademark or logo of Digital Equipment
     20  1.1  thorpej  *    Corporation may be used to endorse or promote products derived
     21  1.1  thorpej  *    from this software without the prior written permission of
     22  1.1  thorpej  *    Digital Equipment Corporation.
     23  1.1  thorpej  *
     24  1.1  thorpej  * 3) This software is provided "AS-IS" and any express or implied
     25  1.1  thorpej  *    warranties, including but not limited to, any implied warranties
     26  1.1  thorpej  *    of merchantability, fitness for a particular purpose, or
     27  1.1  thorpej  *    non-infringement are disclaimed. In no event shall DIGITAL be
     28  1.1  thorpej  *    liable for any damages whatsoever, and in particular, DIGITAL
     29  1.1  thorpej  *    shall not be liable for special, indirect, consequential, or
     30  1.1  thorpej  *    incidental damages or damages for lost profits, loss of
     31  1.1  thorpej  *    revenue or loss of use, whether such damages arise in contract,
     32  1.1  thorpej  *    negligence, tort, under statute, in equity, at law or otherwise,
     33  1.1  thorpej  *    even if advised of the possibility of such damage.
     34  1.1  thorpej  */
     35  1.1  thorpej 
     36  1.1  thorpej /*
     37  1.1  thorpej  * Copyright (c) 1994-1998 Mark Brinicombe.
     38  1.1  thorpej  * Copyright (c) 1994 Brini.
     39  1.1  thorpej  * All rights reserved.
     40  1.1  thorpej  *
     41  1.1  thorpej  * This code is derived from software written for Brini by Mark Brinicombe
     42  1.1  thorpej  *
     43  1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     44  1.1  thorpej  * modification, are permitted provided that the following conditions
     45  1.1  thorpej  * are met:
     46  1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     47  1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     48  1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     50  1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     51  1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     52  1.1  thorpej  *    must display the following acknowledgement:
     53  1.1  thorpej  *	This product includes software developed by Mark Brinicombe
     54  1.1  thorpej  *	for the NetBSD Project.
     55  1.1  thorpej  * 4. The name of the company nor the name of the author may be used to
     56  1.1  thorpej  *    endorse or promote products derived from this software without specific
     57  1.1  thorpej  *    prior written permission.
     58  1.1  thorpej  *
     59  1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     60  1.1  thorpej  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     61  1.1  thorpej  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     62  1.1  thorpej  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     63  1.1  thorpej  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     64  1.1  thorpej  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     65  1.1  thorpej  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     66  1.1  thorpej  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     67  1.1  thorpej  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     68  1.1  thorpej  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     69  1.1  thorpej  *
     70  1.1  thorpej  * 	from: irq.S
     71  1.1  thorpej  *
     72  1.1  thorpej  * Low level irq and fiq handlers
     73  1.1  thorpej  *
     74  1.1  thorpej  * Created      : 27/09/94
     75  1.1  thorpej  */
     76  1.1  thorpej 
     77  1.1  thorpej #include "opt_irqstats.h"
     78  1.1  thorpej 
     79  1.1  thorpej #include "assym.h"
     80  1.1  thorpej #include <machine/asm.h>
     81  1.1  thorpej #include <machine/cpu.h>
     82  1.1  thorpej #include <machine/frame.h>
     83  1.1  thorpej #include <dev/isa/isareg.h>
     84  1.1  thorpej #include <shark/isa/icu.h>
     85  1.1  thorpej #include <machine/irqhandler.h>
     86  1.1  thorpej 
     87  1.1  thorpej 	.text
     88  1.1  thorpej 	.align	0
     89  1.1  thorpej 
     90  1.1  thorpej /*
     91  1.1  thorpej  *
     92  1.1  thorpej  * irq_entry
     93  1.1  thorpej  *
     94  1.1  thorpej  * Main entry point for the IRQ vector
     95  1.1  thorpej  *
     96  1.1  thorpej  * This function reads the irq request bits in the IOMD registers
     97  1.1  thorpej  * IRQRQA, IRQRQB and DMARQ
     98  1.1  thorpej  * It then calls an installed handler for each bit that is set.
     99  1.1  thorpej  * The function stray_irqhandler is called if a handler is not defined
    100  1.1  thorpej  * for a particular interrupt.
    101  1.1  thorpej  * If a interrupt handler is found then it is called with r0 containing
    102  1.1  thorpej  * the argument defined in the handler structure. If the field ih_arg
    103  1.1  thorpej  * is zero then a pointer to the IRQ frame on the stack is passed instead.
    104  1.1  thorpej  */
    105  1.1  thorpej 
    106  1.1  thorpej Ldisabled_mask:
    107  1.1  thorpej 	.word	_C_LABEL(disabled_mask)
    108  1.1  thorpej 
    109  1.1  thorpej Lcurrent_spl_level:
    110  1.1  thorpej 	.word	_C_LABEL(current_spl_level)
    111  1.1  thorpej 
    112  1.1  thorpej Lcurrent_intr_depth:
    113  1.1  thorpej 	.word	_C_LABEL(current_intr_depth)
    114  1.1  thorpej 
    115  1.1  thorpej Lvam_io_data:
    116  1.1  thorpej 	.word	_C_LABEL(isa_io_bs_tag)
    117  1.1  thorpej 
    118  1.1  thorpej Lspl_masks:
    119  1.1  thorpej 	.word	_C_LABEL(spl_masks)
    120  1.1  thorpej 
    121  1.1  thorpej /*
    122  1.1  thorpej  * Register usage
    123  1.1  thorpej  *
    124  1.1  thorpej  *  r6  - Address of current handler
    125  1.1  thorpej  *  r7  - Pointer to handler pointer list
    126  1.1  thorpej  *  r8  - Current IRQ requests.
    127  1.1  thorpej  *  r9  - Used to count through possible IRQ bits.
    128  1.1  thorpej  *  r10 - Base address of IOMD
    129  1.1  thorpej  */
    130  1.1  thorpej 
    131  1.1  thorpej /* Some documentation is in isa_machdep.c */
    132  1.1  thorpej ASENTRY_NP(irq_entry)
    133  1.1  thorpej 	sub	lr, lr, #0x00000004	/* Adjust the lr */
    134  1.1  thorpej 
    135  1.1  thorpej 	PUSHFRAMEINSVC			/* Push an interrupt frame */
    136  1.3      scw 	ENABLE_ALIGNMENT_FAULTS
    137  1.1  thorpej 
    138  1.1  thorpej 	/* Load r8 with the ISA 8259 irqs */
    139  1.1  thorpej 	/* r8 <- irq's pending [15:0] */
    140  1.1  thorpej 
    141  1.1  thorpej 	/* address of 8259 #1 */
    142  1.1  thorpej 	ldr	r0, Lvam_io_data
    143  1.1  thorpej 	ldr	r0, [r0]
    144  1.1  thorpej 	ldrb	r8, [r0, #IO_ICU1]                /* ocw3 = irr */
    145  1.1  thorpej 
    146  1.1  thorpej 	/* clear the IRR bits that are currently masked. */
    147  1.1  thorpej 	ldr	r2, Li8259_mask
    148  1.1  thorpej 	ldr	r2, [r2]
    149  1.1  thorpej 	mvn	r2, r2                            /* disabled -> enabled */
    150  1.1  thorpej 
    151  1.1  thorpej 	/* address of 8259 #2 */
    152  1.1  thorpej 	tst	r2, #(1 << IRQ_SLAVE)             /* if slave is enabled */
    153  1.1  thorpej 	tstne	r8, #(1 << IRQ_SLAVE)             /* anything from slave? */
    154  1.1  thorpej 	ldrneb	r1, [r0, #IO_ICU2]                /* ocw3 = irr */
    155  1.1  thorpej 	orrne	r8, r8, r1, lsl #8
    156  1.1  thorpej 
    157  1.1  thorpej 	and	r8, r8, r2                        /* clear disabled */
    158  1.1  thorpej 
    159  1.1  thorpej 	/* clear IRQ 2, which is only used for slave 8259 */
    160  1.1  thorpej 	bic	r8, r8, #(1 << IRQ_SLAVE)
    161  1.1  thorpej 
    162  1.1  thorpej 	/*
    163  1.1  thorpej 	 * Note that we have entered the IRQ handler.
    164  1.1  thorpej 	 * We are in SVC mode so we cannot use the processor mode
    165  1.1  thorpej 	 * to determine if we are in an IRQ. Instead we will count the
    166  1.1  thorpej 	 * each time the interrupt handler is nested.
    167  1.1  thorpej 	 */
    168  1.1  thorpej 
    169  1.1  thorpej 	ldr	r0, Lcurrent_intr_depth
    170  1.1  thorpej 	ldr	r1, [r0]
    171  1.1  thorpej 	add	r1, r1, #1
    172  1.1  thorpej 	str	r1, [r0]
    173  1.1  thorpej 
    174  1.1  thorpej 	/* Block the current requested interrupts */
    175  1.1  thorpej 
    176  1.1  thorpej 	ldr	r1, Ldisabled_mask
    177  1.1  thorpej 	ldr	r0, [r1]
    178  1.1  thorpej 	stmfd	sp!, {r0}
    179  1.1  thorpej 	orr	r0, r0, r8
    180  1.1  thorpej 
    181  1.1  thorpej 	/*
    182  1.1  thorpej  	 * Need to block all interrupts at the IPL or lower for
    183  1.1  thorpej 	 * all asserted interrupts.
    184  1.1  thorpej 	 * This basically emulates hardware interrupt priority levels.
    185  1.1  thorpej 	 * Means we need to go through the interrupt mask and for
    186  1.1  thorpej 	 * every asserted interrupt we need to mask out all other
    187  1.1  thorpej 	 * interrupts at the same or lower IPL.
    188  1.1  thorpej 	 * If only we could wait until the main loop but we need to sort
    189  1.1  thorpej 	 * this out first so interrupts can be re-enabled.
    190  1.1  thorpej 	 *
    191  1.1  thorpej 	 * This would benefit from a special ffs type routine
    192  1.1  thorpej 	 */
    193  1.1  thorpej 
    194  1.1  thorpej 	mov	r9, #(_SPL_LEVELS - 1)
    195  1.1  thorpej 	ldr	r7, Lspl_masks
    196  1.1  thorpej 
    197  1.1  thorpej Lfind_highest_ipl:
    198  1.1  thorpej 	ldr	r2, [r7, r9, lsl #2]
    199  1.1  thorpej 	tst	r8, r2
    200  1.1  thorpej 	subeq	r9, r9, #1
    201  1.1  thorpej 	beq	Lfind_highest_ipl
    202  1.1  thorpej 
    203  1.1  thorpej 	/* r9 = SPL level of highest priority interrupt */
    204  1.1  thorpej 	add	r9, r9, #1
    205  1.1  thorpej 	ldr	r2, [r7, r9, lsl #2]
    206  1.1  thorpej 	mvn	r2, r2
    207  1.1  thorpej 	orr	r0, r0, r2
    208  1.1  thorpej 
    209  1.1  thorpej 	str	r0, [r1]
    210  1.1  thorpej 
    211  1.1  thorpej 	ldr	r0, Lcurrent_spl_level
    212  1.1  thorpej 	ldr	r1, [r0]
    213  1.1  thorpej 	str	r9, [r0]
    214  1.1  thorpej 	stmfd	sp!, {r1}
    215  1.1  thorpej 
    216  1.1  thorpej 	/* Update the IOMD irq masks */
    217  1.1  thorpej 	bl	_C_LABEL(irq_setmasks)
    218  1.1  thorpej 
    219  1.1  thorpej         mrs     r0, cpsr_all		/* Enable IRQ's */
    220  1.1  thorpej 	bic	r0, r0, #I32_bit
    221  1.1  thorpej 	msr	cpsr_all, r0
    222  1.1  thorpej 
    223  1.2    bjh21 	ldr	r7, Lirqhandlers
    224  1.1  thorpej         mov	r9, #0x00000001
    225  1.1  thorpej 
    226  1.1  thorpej irqloop:
    227  1.1  thorpej 	/* This would benefit from a special ffs type routine */
    228  1.1  thorpej 	tst	r8, r9			/* Is a bit set ? */
    229  1.1  thorpej 	beq	nextirq			/* No ? try next bit */
    230  1.1  thorpej 
    231  1.1  thorpej 	ldr	r6, [r7]		/* Get address of first handler structure */
    232  1.1  thorpej 
    233  1.1  thorpej 	teq	r6, #0x00000000		/* Do we have a handler */
    234  1.1  thorpej 	moveq	r0, r8			/* IRQ requests as arg 0 */
    235  1.1  thorpej 	beq	_C_LABEL(stray_irqhandler) /* call special handler */
    236  1.1  thorpej 
    237  1.1  thorpej 	ldr	r0, Lcnt
    238  1.1  thorpej 	ldr	r1, [r0, #(V_INTR)]
    239  1.1  thorpej 	add	r1, r1, #0x00000001
    240  1.1  thorpej 	str	r1, [r0, #(V_INTR)]
    241  1.1  thorpej 
    242  1.1  thorpej 	/*
    243  1.1  thorpej 	 * XXX: Should stats be accumlated for every interrupt routine called
    244  1.1  thorpej 	 * or for every physical interrupt that is serviced.
    245  1.1  thorpej 	 */
    246  1.1  thorpej 
    247  1.1  thorpej #ifdef IRQSTATS
    248  1.1  thorpej         ldr	r0, Lintrcnt
    249  1.1  thorpej 	ldr	r1, [r6, #(IH_NUM)]
    250  1.1  thorpej 
    251  1.1  thorpej 	add	r0, r0, r1, lsl #2
    252  1.1  thorpej 	ldr	r1, [r0]
    253  1.1  thorpej 	add	r1, r1, #0x00000001
    254  1.1  thorpej 	str	r1, [r0]
    255  1.1  thorpej #endif	/* IRQSTATS */
    256  1.1  thorpej 
    257  1.1  thorpej irqchainloop:
    258  1.1  thorpej 	ldr	r0, [r6, #(IH_ARG)]	/* Get argument pointer */
    259  1.1  thorpej 	teq	r0, #0x00000000		/* If arg is zero pass stack frame */
    260  1.1  thorpej 	addeq	r0, sp, #8		/* ... stack frame */
    261  1.2    bjh21 	mov	lr, pc			/* return address */
    262  1.1  thorpej 	ldr	pc, [r6, #(IH_FUNC)]	/* Call handler */
    263  1.1  thorpej 
    264  1.1  thorpej 	teq	r0, #0x00000001		/* Was the irq serviced ? */
    265  1.1  thorpej 	beq	irqdone
    266  1.1  thorpej 
    267  1.1  thorpej 	ldr	r6, [r6, #(IH_NEXT)]
    268  1.1  thorpej 	teq	r6, #0x00000000
    269  1.1  thorpej 	bne	irqchainloop
    270  1.1  thorpej 
    271  1.1  thorpej irqdone:
    272  1.1  thorpej nextirq:
    273  1.1  thorpej 	add	r7, r7, #0x00000004	/* update pointer to handlers */
    274  1.1  thorpej 	mov	r9, r9, lsl #1		/* move on to next bit */
    275  1.1  thorpej 	teq	r9, #(1 << 16)		/* done the last bit ? */
    276  1.1  thorpej 	bne	irqloop			/* no - loop back. */
    277  1.1  thorpej 
    278  1.1  thorpej 	ldmfd	sp!, {r2}
    279  1.1  thorpej 	ldr	r1, Lcurrent_spl_level
    280  1.1  thorpej 	str	r2, [r1]
    281  1.1  thorpej 
    282  1.1  thorpej 	/* Restore previous disabled mask */
    283  1.1  thorpej 	ldmfd	sp!, {r2}
    284  1.1  thorpej 	ldr	r1, Ldisabled_mask
    285  1.1  thorpej 	str	r2, [r1]
    286  1.1  thorpej 	bl	_C_LABEL(irq_setmasks)
    287  1.1  thorpej 
    288  1.1  thorpej 	bl	_C_LABEL(dosoftints)	/* Handle the soft interrupts */
    289  1.1  thorpej 
    290  1.1  thorpej 	/* Kill IRQ's in preparation for exit */
    291  1.1  thorpej         mrs     r0, cpsr_all
    292  1.1  thorpej         orr     r0, r0, #(I32_bit)
    293  1.1  thorpej         msr     cpsr_all, r0
    294  1.1  thorpej 
    295  1.1  thorpej 	/* Decrement the nest count */
    296  1.1  thorpej 	ldr	r0, Lcurrent_intr_depth
    297  1.1  thorpej 	ldr	r1, [r0]
    298  1.1  thorpej 	sub	r1, r1, #1
    299  1.1  thorpej 	str	r1, [r0]
    300  1.1  thorpej 
    301  1.3      scw 	DO_AST_AND_RESTORE_ALIGNMENT_FAULTS
    302  1.1  thorpej 	PULLFRAMEFROMSVCANDEXIT
    303  1.1  thorpej 
    304  1.1  thorpej 	/* NOT REACHED */
    305  1.1  thorpej 	b	. - 8
    306  1.1  thorpej 
    307  1.1  thorpej Lspl_mask:
    308  1.1  thorpej 	.word	_C_LABEL(spl_mask)	/* irq's allowed at current spl level */
    309  1.1  thorpej 
    310  1.1  thorpej Lcurrent_mask:
    311  1.1  thorpej 	.word	_C_LABEL(current_mask)	/* irq's that are usable */
    312  1.1  thorpej 
    313  1.3      scw AST_ALIGNMENT_FAULT_LOCALS
    314  1.3      scw 
    315  1.3      scw 
    316  1.1  thorpej ENTRY(irq_setmasks)
    317  1.1  thorpej 	/* Disable interrupts */
    318  1.1  thorpej 	mrs	r3, cpsr_all
    319  1.1  thorpej 	orr	r1, r3,  #(I32_bit)
    320  1.1  thorpej 	msr	cpsr_all, r1
    321  1.1  thorpej 
    322  1.1  thorpej 	/* Calculate interrupt mask */
    323  1.1  thorpej 	ldr	r1, Lcurrent_mask	/* All the enabled interrupts */
    324  1.1  thorpej 	ldrh	r1, [r1]		/* get hardware bits of mask */
    325  1.1  thorpej /*	.word	0xe0d110b0 */		/* hand-assembled ldrh r1, [r1] */
    326  1.1  thorpej 	ldr	r2, Lspl_mask		/* Block due to current spl level */
    327  1.1  thorpej 	ldr	r2, [r2]
    328  1.1  thorpej 	and	r1, r1, r2
    329  1.1  thorpej 	ldr	r2, Ldisabled_mask	/* Block due to active interrupts */
    330  1.1  thorpej 	ldr	r2, [r2]
    331  1.1  thorpej 	bic	r1, r1, r2
    332  1.1  thorpej 
    333  1.1  thorpej 	/* since 8259's are so slow to access, this code does everything
    334  1.1  thorpej 	   possible to avoid them */
    335  1.1  thorpej 
    336  1.1  thorpej 	/* get current mask: these are the bits */
    337  1.1  thorpej 	ldr	r0, Li8259_mask
    338  1.1  thorpej 	ldr	r2, [r0]
    339  1.1  thorpej 	/*       r2 = 0000.0000.0000.0000.ZZZZ.ZZZZ.ZZZZ.ZZZZ   */
    340  1.1  thorpej 
    341  1.1  thorpej 	/* see if there's anything enabled on 8259 #2 */
    342  1.1  thorpej 	tst	r1, #0xff00
    343  1.1  thorpej 
    344  1.1  thorpej 	biceq	r1, r1, #(1 << IRQ_SLAVE)  /* no, so disable it */
    345  1.1  thorpej 	orrne	r1, r1, #(1 << IRQ_SLAVE)  /* yes, so enable it */
    346  1.1  thorpej 	/* eq => r1 = 0000.0000.0000.0000.0000.0000.MMMM.M0MM
    347  1.1  thorpej            ne => r1 = 0000.0000.0000.0000.MMMM.MMMM.MMMM.M1MM   */
    348  1.1  thorpej 
    349  1.1  thorpej 	/* 8259 bit high => disable */
    350  1.1  thorpej 	mvn	r1, r1
    351  1.1  thorpej 	/* eq => r1 = 1111.1111.1111.1111.1111.1111.YYYY.Y1YY
    352  1.1  thorpej            ne => r1 = 1111.1111.1111.1111.YYYY.YYYY.YYYY.Y0YY
    353  1.1  thorpej            (for each bit position Y = !M)                       */
    354  1.1  thorpej 
    355  1.1  thorpej 	orreq	r1, r2, r1, lsl #16
    356  1.1  thorpej 	/* eq => r1 = 1111.1111.YYYY.Y1YY.ZZZZ.ZZZZ.ZZZZ.ZZZZ
    357  1.1  thorpej            ne => r1 = 1111.1111.1111.1111.YYYY.YYYY.YYYY.Y0YY   */
    358  1.1  thorpej 	orreq	r1, r1, #0x000000FF
    359  1.1  thorpej 	/* eq => r1 = 1111.1111.YYYY.Y1YY.ZZZZ.ZZZZ.1111.1111
    360  1.1  thorpej            ne => r1 = 1111.1111.1111.1111.YYYY.YYYY.YYYY.Y0YY   */
    361  1.1  thorpej 	and	r1, r1, r1, lsr #16
    362  1.1  thorpej 	/* eq => r1 = 0000.0000.0000.0000.ZZZZ.ZZZZ.YYYY.Y1YY
    363  1.1  thorpej            ne => r1 = 0000.0000.0000.0000.YYYY.YYYY.YYYY.Y0YY   */
    364  1.1  thorpej 
    365  1.1  thorpej 	/* if old = new, don't bother to set again.
    366  1.1  thorpej 	   fast path to exit, since 8259's are so slow anyway */
    367  1.1  thorpej 	eors	r2, r1, r2                /* which bits are different? */
    368  1.1  thorpej 	msreq	cpsr_all, r3              /* no bits are different, return */
    369  1.1  thorpej 	moveq	pc, lr
    370  1.1  thorpej 
    371  1.1  thorpej 	/* have to set at least one of the 8259's, store new mask */
    372  1.1  thorpej 	str	r1, [r0]
    373  1.1  thorpej 	ldr	r0, Lvam_io_data
    374  1.1  thorpej 	ldr	r0, [r0]
    375  1.1  thorpej 
    376  1.1  thorpej 	/* see if there's any change for 8259 #1 (master) */
    377  1.1  thorpej 	tst	r2, #0x00FF               /* bottom 8 bits different? */
    378  1.1  thorpej 	strneb	r1, [r0, #(IO_ICU1 + 1)]  /* icu1 / ocw1 */
    379  1.1  thorpej 
    380  1.1  thorpej 	/* anything for 8259 #2? */
    381  1.1  thorpej 	tst	r2, #0xFF00
    382  1.1  thorpej 	mov	r1, r1, lsr #8            /* next byte */
    383  1.1  thorpej 	strneb	r1, [r0, #(IO_ICU2 + 1)]  /* icu2 / ocw1 */
    384  1.1  thorpej 
    385  1.1  thorpej 	/* Restore old cpsr and exit */
    386  1.1  thorpej 	msr	cpsr_all, r3
    387  1.1  thorpej 	mov	pc, lr
    388  1.1  thorpej 
    389  1.1  thorpej Lcnt:
    390  1.1  thorpej 	.word	_C_LABEL(uvmexp)
    391  1.1  thorpej 
    392  1.1  thorpej Lintrcnt:
    393  1.1  thorpej 	.word	_C_LABEL(intrcnt)
    394  1.1  thorpej 
    395  1.1  thorpej Li8259_mask:
    396  1.1  thorpej 	.word	_C_LABEL(i8259_mask)
    397  1.1  thorpej 
    398  1.1  thorpej Lirqhandlers:
    399  1.1  thorpej 	.word	_C_LABEL(irqhandlers)	/* Pointer to array of irqhandlers */
    400  1.1  thorpej 
    401  1.1  thorpej #ifdef IRQSTATS
    402  1.1  thorpej /* These symbols are used by vmstat */
    403  1.1  thorpej 
    404  1.1  thorpej 	.text
    405  1.1  thorpej 	.global	_C_LABEL(_intrnames)
    406  1.1  thorpej _C_LABEL(_intrnames):
    407  1.1  thorpej 	.word	_C_LABEL(intrnames)
    408  1.1  thorpej 
    409  1.1  thorpej 	.data
    410  1.1  thorpej 
    411  1.1  thorpej 	/* XXX fix */
    412  1.1  thorpej         .globl  _C_LABEL(intrnames), _C_LABEL(eintrnames), _C_LABEL(intrcnt), _C_LABEL(sintrcnt), _C_LABEL(eintrcnt)
    413  1.1  thorpej _C_LABEL(intrnames):
    414  1.1  thorpej 	.asciz	"interrupt  0 "
    415  1.1  thorpej 	.asciz	"interrupt  1 "
    416  1.1  thorpej 	.asciz	"interrupt  2 "
    417  1.1  thorpej 	.asciz	"interrupt  3 "
    418  1.1  thorpej 	.asciz	"interrupt  4 "
    419  1.1  thorpej 	.asciz	"interrupt  5 "
    420  1.1  thorpej 	.asciz	"interrupt  6 "
    421  1.1  thorpej 	.asciz	"interrupt  7 "
    422  1.1  thorpej 	.asciz	"interrupt  8 "
    423  1.1  thorpej 	.asciz	"interrupt  9 "
    424  1.1  thorpej 	.asciz	"interrupt 10 "
    425  1.1  thorpej 	.asciz	"interrupt 11 "
    426  1.1  thorpej 	.asciz	"interrupt 12 "
    427  1.1  thorpej 	.asciz	"interrupt 13 "
    428  1.1  thorpej 	.asciz	"interrupt 14 "
    429  1.1  thorpej 	.asciz	"interrupt 15 "
    430  1.1  thorpej 	.asciz	"interrupt 16 "
    431  1.1  thorpej 	.asciz	"interrupt 17 "
    432  1.1  thorpej 	.asciz	"interrupt 18 "
    433  1.1  thorpej 	.asciz	"interrupt 19 "
    434  1.1  thorpej 	.asciz	"interrupt 20 "
    435  1.1  thorpej 	.asciz	"interrupt 21 "
    436  1.1  thorpej 	.asciz	"interrupt 22 "
    437  1.1  thorpej 	.asciz	"interrupt 23 "
    438  1.1  thorpej 	.asciz	"interrupt 24 "
    439  1.1  thorpej 	.asciz	"interrupt 25 "
    440  1.1  thorpej 	.asciz	"interrupt 26 "
    441  1.1  thorpej 	.asciz	"interrupt 27 "
    442  1.1  thorpej 	.asciz	"interrupt 28 "
    443  1.1  thorpej 	.asciz	"interrupt 29 "
    444  1.1  thorpej 	.asciz	"interrupt 30 "
    445  1.1  thorpej 	.asciz	"interrupt 31 "
    446  1.1  thorpej 
    447  1.1  thorpej _C_LABEL(sintrnames):
    448  1.1  thorpej 	.asciz	"soft int  0  "
    449  1.1  thorpej 	.asciz	"soft int  1  "
    450  1.1  thorpej 	.asciz	"soft int  2  "
    451  1.1  thorpej 	.asciz	"soft int  3  "
    452  1.1  thorpej 	.asciz	"soft int  4  "
    453  1.1  thorpej 	.asciz	"soft int  5  "
    454  1.1  thorpej 	.asciz	"soft int  6  "
    455  1.1  thorpej 	.asciz	"soft int  7  "
    456  1.1  thorpej 	.asciz	"soft int  8  "
    457  1.1  thorpej 	.asciz	"soft int  9  "
    458  1.1  thorpej 	.asciz	"soft int 10  "
    459  1.1  thorpej 	.asciz	"soft int 11  "
    460  1.1  thorpej 	.asciz	"soft int 12  "
    461  1.1  thorpej 	.asciz	"soft int 13  "
    462  1.1  thorpej 	.asciz	"soft int 14  "
    463  1.1  thorpej 	.asciz	"soft int 15  "
    464  1.1  thorpej 	.asciz	"soft int 16  "
    465  1.1  thorpej 	.asciz	"soft int 17  "
    466  1.1  thorpej 	.asciz	"soft int 18  "
    467  1.1  thorpej 	.asciz	"soft int 19  "
    468  1.1  thorpej 	.asciz	"soft int 20  "
    469  1.1  thorpej 	.asciz	"soft int 21  "
    470  1.1  thorpej 	.asciz	"soft int 22  "
    471  1.1  thorpej 	.asciz	"soft int 23  "
    472  1.1  thorpej 	.asciz	"soft int 24  "
    473  1.1  thorpej 	.asciz	"soft int 25  "
    474  1.1  thorpej 	.asciz	"soft int 26  "
    475  1.1  thorpej 	.asciz	"soft int 27  "
    476  1.1  thorpej 	.asciz	"soft int 28  "
    477  1.1  thorpej 	.asciz	"soft int 29  "
    478  1.1  thorpej 	.asciz	"soft int 30  "
    479  1.1  thorpej 	.asciz	"soft int 31  "
    480  1.1  thorpej _C_LABEL(eintrnames):
    481  1.1  thorpej 
    482  1.1  thorpej 	.bss
    483  1.1  thorpej 	.align	0
    484  1.1  thorpej _C_LABEL(intrcnt):
    485  1.1  thorpej 	.space	32*4	/* XXX Should be linked to number of interrupts */
    486  1.1  thorpej _C_LABEL(sintrcnt):
    487  1.1  thorpej 	.space	32*4	/* XXX Should be linked to number of soft ints */
    488  1.1  thorpej _C_LABEL(eintrcnt):
    489  1.1  thorpej 
    490  1.1  thorpej #else	/* IRQSTATS */
    491  1.1  thorpej 	/* Dummy entries to keep vmstat happy */
    492  1.1  thorpej 
    493  1.1  thorpej 	.text
    494  1.1  thorpej         .globl  _C_LABEL(intrnames), _C_LABEL(eintrnames), _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
    495  1.1  thorpej _C_LABEL(intrnames):
    496  1.1  thorpej 	.long	0
    497  1.1  thorpej _C_LABEL(eintrnames):
    498  1.1  thorpej 
    499  1.1  thorpej _C_LABEL(intrcnt):
    500  1.1  thorpej 	.long	0
    501  1.1  thorpej _C_LABEL(eintrcnt):
    502  1.1  thorpej #endif	/* IRQSTATS */
    503