Home | History | Annotate | Line # | Download | only in rmi
rmixl_spl.S revision 1.1.2.4
      1  1.1.2.4  cliff /*	$NetBSD: rmixl_spl.S,v 1.1.2.4 2010/05/28 22:14:53 cliff Exp $	*/
      2  1.1.2.1  cliff 
      3  1.1.2.1  cliff /*-
      4  1.1.2.1  cliff  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
      5  1.1.2.1  cliff  * All rights reserved.
      6  1.1.2.1  cliff  *
      7  1.1.2.1  cliff  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1.2.1  cliff  * by Matt Thomas <matt (at) 3am-software.com>.
      9  1.1.2.1  cliff  *
     10  1.1.2.1  cliff  * Redistribution and use in source and binary forms, with or without
     11  1.1.2.1  cliff  * modification, are permitted provided that the following conditions
     12  1.1.2.1  cliff  * are met:
     13  1.1.2.1  cliff  * 1. Redistributions of source code must retain the above copyright
     14  1.1.2.1  cliff  *    notice, this list of conditions and the following disclaimer.
     15  1.1.2.1  cliff  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1.2.1  cliff  *    notice, this list of conditions and the following disclaimer in the
     17  1.1.2.1  cliff  *    documentation and/or other materials provided with the distribution.
     18  1.1.2.1  cliff  *
     19  1.1.2.1  cliff  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1.2.1  cliff  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1.2.1  cliff  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1.2.1  cliff  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1.2.1  cliff  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1.2.1  cliff  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1.2.1  cliff  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1.2.1  cliff  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1.2.1  cliff  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1.2.1  cliff  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1.2.1  cliff  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1.2.1  cliff  */
     31  1.1.2.1  cliff 
     32  1.1.2.1  cliff #include "opt_cputype.h"	/* which mips CPU levels do we support? */
     33  1.1.2.1  cliff 
     34  1.1.2.1  cliff #include <sys/cdefs.h>
     35  1.1.2.1  cliff 
     36  1.1.2.1  cliff #include <machine/param.h>
     37  1.1.2.1  cliff #include <mips/asm.h>
     38  1.1.2.1  cliff #include <mips/cpuregs.h>
     39  1.1.2.1  cliff 
     40  1.1.2.4  cliff RCSID("$NetBSD: rmixl_spl.S,v 1.1.2.4 2010/05/28 22:14:53 cliff Exp $");
     41  1.1.2.1  cliff 
     42  1.1.2.1  cliff #include "assym.h"
     43  1.1.2.1  cliff 
     44  1.1.2.1  cliff 
     45  1.1.2.1  cliff #define MAP_SCALESHIFT		3
     46  1.1.2.3  cliff #define RMIXL_SOFT_INT_MASK_1	(MIPS_SOFT_INT_MASK_1 >> 8)
     47  1.1.2.1  cliff #define RMIXL_SOFT_INT_MASK	(MIPS_SOFT_INT_MASK >> 8)
     48  1.1.2.1  cliff #define RMIXL_INT_MASK_1	(MIPS_INT_MASK_1 >> 8)
     49  1.1.2.1  cliff #define RMIXL_INT_MASK_5	(MIPS_INT_MASK_5 >> 8)
     50  1.1.2.1  cliff #define RMIXL_COP_0_EIRR	_(9), 6
     51  1.1.2.1  cliff #define RMIXL_COP_0_EIMR	_(9), 7
     52  1.1.2.1  cliff 
     53  1.1.2.1  cliff 
     54  1.1.2.1  cliff /*
     55  1.1.2.1  cliff  * Array of mask of bits to set in the EIMR when we go to a
     56  1.1.2.1  cliff  * given hardware interrupt priority level.
     57  1.1.2.3  cliff  * The softint bits in [IPL_NONE] and [IPL_SOFTCLOCK] should stay constant
     58  1.1.2.3  cliff  * Hard intr bits are managed by rmixl_vec_establish and rmixl_vec_disestablish.
     59  1.1.2.1  cliff  */
     60  1.1.2.3  cliff 	.data
     61  1.1.2.1  cliff 	.globl	_C_LABEL(ipl_eimr_map)
     62  1.1.2.1  cliff 	.type	_C_LABEL(ipl_eimr_map),@object
     63  1.1.2.1  cliff 	.p2align MAP_SCALESHIFT
     64  1.1.2.1  cliff _C_LABEL(ipl_eimr_map):
     65  1.1.2.3  cliff 	.dword	RMIXL_SOFT_INT_MASK	/* IPL_NONE */
     66  1.1.2.3  cliff 	.dword	RMIXL_SOFT_INT_MASK_1	/* IPL_SOFT{CLOCK,BIO} */
     67  1.1.2.3  cliff 	.dword	0			/* IPL_SOFT{NET,SERIAL} */
     68  1.1.2.3  cliff 	.dword	0			/* IPL_VM */
     69  1.1.2.1  cliff 	.dword	0			/* IPL_SCHED */
     70  1.1.2.3  cliff 	.dword	0			/* IPL_DDB */
     71  1.1.2.1  cliff 	.dword	0			/* IPL_HIGH */
     72  1.1.2.1  cliff 
     73  1.1.2.1  cliff 	.text
     74  1.1.2.4  cliff 
     75  1.1.2.4  cliff /*
     76  1.1.2.4  cliff  * initialize cp0 interrupt control for this cpu
     77  1.1.2.4  cliff  * - set STATUS[IE]
     78  1.1.2.4  cliff  * - clear EIRR and EIMR
     79  1.1.2.4  cliff  * on return, all interrupts are disabled by EIMR
     80  1.1.2.4  cliff  *
     81  1.1.2.4  cliff  * henceforth STATUS[IE] is expected to remain normally set
     82  1.1.2.4  cliff  * but may be cleared and restored for temporary interrupt disablement
     83  1.1.2.4  cliff  *
     84  1.1.2.4  cliff  * call before the first call to spl0 on this cpu
     85  1.1.2.4  cliff  */
     86  1.1.2.4  cliff LEAF_NOPROFILE(rmixl_spl_init_cpu)
     87  1.1.2.4  cliff 	mfc0	t0, MIPS_COP_0_STATUS		# get STATUS
     88  1.1.2.4  cliff 	ori	t0, MIPS_SR_INT_IE		# set IE
     89  1.1.2.4  cliff 	mtc0	zero, MIPS_COP_0_STATUS		## disable all ints in STATUS
     90  1.1.2.4  cliff 	dmtc0	zero, RMIXL_COP_0_EIMR		##  "       "   "   "  EIMR
     91  1.1.2.4  cliff 	dmtc0	zero, RMIXL_COP_0_EIRR		## clear EIRR
     92  1.1.2.4  cliff 	mtc0	t0, MIPS_COP_0_STATUS		## set STATUS | IE
     93  1.1.2.4  cliff 	j	ra
     94  1.1.2.4  cliff 	 nop
     95  1.1.2.4  cliff END(rmixl_spl_init_cpu)
     96  1.1.2.4  cliff 
     97  1.1.2.1  cliff /*
     98  1.1.2.1  cliff  * RMIXL processor interrupt control
     99  1.1.2.1  cliff  *
    100  1.1.2.1  cliff  * Used as building blocks for spl(9) kernel interface.
    101  1.1.2.1  cliff  */
    102  1.1.2.1  cliff _splraise:
    103  1.1.2.1  cliff 	/*
    104  1.1.2.1  cliff 	 * a0 = EIMR bits to be set for this IPL
    105  1.1.2.1  cliff 	 * a1 = this IPL (IPL_*)
    106  1.1.2.1  cliff 	 * Can only use a0-a3 and v0-v1
    107  1.1.2.1  cliff 	 */
    108  1.1.2.1  cliff 	PTR_L	a3, L_CPU(MIPS_CURLWP)
    109  1.1.2.1  cliff 	INT_L	v0, CPU_INFO_CPL(a3)		# get current IPL from cpu_info
    110  1.1.2.1  cliff 	sltu	v1, a1, v0			# newipl < curipl
    111  1.1.2.1  cliff 	bnez	v1, 2f				# yes, don't change.
    112  1.1.2.4  cliff 	 nop
    113  1.1.2.4  cliff 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
    114  1.1.2.1  cliff 	INT_S	a1, CPU_INFO_CPL(a3)		## save IPL in cpu_info
    115  1.1.2.1  cliff 	dmtc0	a0, RMIXL_COP_0_EIMR		## set new EIMR
    116  1.1.2.1  cliff #ifdef PARANOIA
    117  1.1.2.1  cliff 	j	ra
    118  1.1.2.1  cliff 	 nop
    119  1.1.2.1  cliff #endif /* PARANOIA */
    120  1.1.2.1  cliff #ifdef PARANOIA
    121  1.1.2.1  cliff 	dmfc0	v0, RMIXL_COP_0_EIMR		# get EIMR
    122  1.1.2.1  cliff 1:	bne	a0, v0, 1b			# loop forever if not equal
    123  1.1.2.1  cliff 	 nop
    124  1.1.2.1  cliff #endif /* PARANOIA */
    125  1.1.2.1  cliff 2:	j	ra
    126  1.1.2.1  cliff 	 nop
    127  1.1.2.1  cliff 
    128  1.1.2.1  cliff STATIC_LEAF(_splsw_splx)
    129  1.1.2.1  cliff STATIC_XLEAF(_splsw_splx_noprof)		# does not get mcount hooks
    130  1.1.2.1  cliff 	PTR_L	a3, L_CPU(MIPS_CURLWP)		# get cpu_info
    131  1.1.2.1  cliff 	INT_L	a2, CPU_INFO_CPL(a3)		# get IPL from cpu_info
    132  1.1.2.1  cliff 	beq	a0, a2, 2f			# if same, nothing to do
    133  1.1.2.1  cliff 	 nop
    134  1.1.2.1  cliff #ifdef PARANOIA
    135  1.1.2.1  cliff 	sltu	v0, a0, a2			# v0 = a0 < a2
    136  1.1.2.1  cliff 99:	beqz	v0, 99b				# loop forever if false
    137  1.1.2.1  cliff 	 nop
    138  1.1.2.1  cliff #endif /* PARANOIA */
    139  1.1.2.1  cliff 	PTR_LA	v1, _C_LABEL(ipl_eimr_map)	# get address of table
    140  1.1.2.1  cliff 	sll	a2, a0, MAP_SCALESHIFT		# convert IPL to array offset
    141  1.1.2.1  cliff 	PTR_ADDU v1, a2				# add to table addr
    142  1.1.2.1  cliff 	REG_L	v1, (v1)			# load EIMR bits for this IPL
    143  1.1.2.1  cliff 1:
    144  1.1.2.1  cliff 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
    145  1.1.2.4  cliff 	INT_S	a0, CPU_INFO_CPL(a3)		## save IPL in cpu_info
    146  1.1.2.1  cliff 	dmtc0	v1, RMIXL_COP_0_EIMR		## set new EIMR
    147  1.1.2.1  cliff #ifdef PARANOIA
    148  1.1.2.1  cliff 	j	ra
    149  1.1.2.1  cliff 	 nop
    150  1.1.2.1  cliff #endif /* PARANOIA */
    151  1.1.2.1  cliff 2:
    152  1.1.2.1  cliff #ifdef PARANOIA
    153  1.1.2.1  cliff 	PTR_LA	v1, _C_LABEL(ipl_eimr_map)	# get address of table
    154  1.1.2.1  cliff 	sll	a2, a0, MAP_SCALESHIFT		# convert IPL to array offset
    155  1.1.2.1  cliff 	PTR_ADDU v1, a2				# add to table addr
    156  1.1.2.1  cliff 	REG_L	a1, (v1)			# load EIMR bits for this IPL
    157  1.1.2.1  cliff 	dmfc0	v1, RMIXL_COP_0_EIMR		# get EIMR
    158  1.1.2.1  cliff 3:	bne	a1, v1, 3b			# loop forever if not equal
    159  1.1.2.1  cliff 	 nop
    160  1.1.2.1  cliff #endif /* PARANOIA */
    161  1.1.2.1  cliff 	j	ra
    162  1.1.2.1  cliff 	 nop
    163  1.1.2.1  cliff END(_splsw_splx)
    164  1.1.2.1  cliff 
    165  1.1.2.1  cliff STATIC_LEAF(_splsw_spl0)
    166  1.1.2.1  cliff 	REG_L	v1, _C_LABEL(ipl_eimr_map) + 8*IPL_NONE
    167  1.1.2.1  cliff 	PTR_L	a3, L_CPU(MIPS_CURLWP)
    168  1.1.2.4  cliff 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
    169  1.1.2.1  cliff #if IPL_NONE == 0
    170  1.1.2.1  cliff 	INT_S	zero, CPU_INFO_CPL(a3)		## set ipl to 0
    171  1.1.2.1  cliff #else
    172  1.1.2.1  cliff #error IPL_NONE != 0
    173  1.1.2.1  cliff #endif
    174  1.1.2.1  cliff 	dmtc0	v1, RMIXL_COP_0_EIMR		## set new EIMR
    175  1.1.2.1  cliff 	j	ra
    176  1.1.2.1  cliff 	 nop
    177  1.1.2.1  cliff END(_splsw_spl0)
    178  1.1.2.1  cliff 
    179  1.1.2.1  cliff LEAF_NOPROFILE(rmixl_spln)
    180  1.1.2.1  cliff 	PTR_LA	v1, _C_LABEL(ipl_eimr_map)	# get address of table
    181  1.1.2.1  cliff 	sll	a2, a0, MAP_SCALESHIFT		# convert IPL to array offset
    182  1.1.2.1  cliff 	PTR_ADDU v1, a2				# add to table addr
    183  1.1.2.1  cliff 	REG_L	v0, (v1)			# load EIMR bits for this IPL
    184  1.1.2.1  cliff 	j	ra
    185  1.1.2.1  cliff 	 nop
    186  1.1.2.1  cliff END(rmixl_spln)
    187  1.1.2.1  cliff 
    188  1.1.2.1  cliff STATIC_LEAF(_splsw_setsoftintr)
    189  1.1.2.4  cliff 	dmfc0	v1, RMIXL_COP_0_EIMR		# save EIMR register
    190  1.1.2.4  cliff 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
    191  1.1.2.1  cliff 	mfc0	v0, MIPS_COP_0_CAUSE		## load cause register
    192  1.1.2.1  cliff 	or	v0, v0, a0			## set soft intr. bits
    193  1.1.2.1  cliff 	mtc0	v0, MIPS_COP_0_CAUSE		## store back
    194  1.1.2.4  cliff 	dmtc0	v1, RMIXL_COP_0_EIMR		## restore EIMR
    195  1.1.2.1  cliff 	j	ra
    196  1.1.2.4  cliff 	 nop
    197  1.1.2.1  cliff END(_splsw_setsoftintr)
    198  1.1.2.1  cliff 
    199  1.1.2.1  cliff STATIC_LEAF(_splsw_clrsoftintr)
    200  1.1.2.4  cliff 	dmfc0	v1, RMIXL_COP_0_EIMR		# save EIMR register
    201  1.1.2.4  cliff 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
    202  1.1.2.1  cliff 	mfc0	v0, MIPS_COP_0_CAUSE		## load cause register
    203  1.1.2.1  cliff 	nor	a0, zero, a0			## bitwise inverse of A0
    204  1.1.2.1  cliff 	and	v0, v0, a0			## clear soft intr. bits
    205  1.1.2.1  cliff 	mtc0	v0, MIPS_COP_0_CAUSE		## store back
    206  1.1.2.4  cliff 	dmtc0	v1, RMIXL_COP_0_EIMR		## enable EIMR
    207  1.1.2.1  cliff 	j	ra
    208  1.1.2.4  cliff 	 nop
    209  1.1.2.1  cliff END(_splsw_clrsoftintr)
    210  1.1.2.1  cliff 
    211  1.1.2.1  cliff STATIC_LEAF(_splsw_splraise)
    212  1.1.2.1  cliff 	move	a1, a0
    213  1.1.2.1  cliff 	PTR_LA	v1, _C_LABEL(ipl_eimr_map)
    214  1.1.2.1  cliff 	sll	a2, a0, MAP_SCALESHIFT
    215  1.1.2.1  cliff 	PTR_ADDU v1, a2
    216  1.1.2.1  cliff 	REG_L	a0, (v1)
    217  1.1.2.1  cliff 	b	_splraise
    218  1.1.2.1  cliff 	 nop
    219  1.1.2.1  cliff END(_splsw_splraise)
    220  1.1.2.1  cliff 
    221  1.1.2.1  cliff STATIC_LEAF(_splsw_splhigh)
    222  1.1.2.1  cliff STATIC_XLEAF(_splsw_splhigh_noprof)
    223  1.1.2.1  cliff 	PTR_L	a3, L_CPU(MIPS_CURLWP)
    224  1.1.2.1  cliff 	INT_L	v0, CPU_INFO_CPL(a3)		# get current IPL from cpu_info
    225  1.1.2.1  cliff 	li	a1, IPL_HIGH			#
    226  1.1.2.1  cliff 	beq	v0, a1, 1f			# don't do anything if IPL_HIGH
    227  1.1.2.4  cliff 	 nop
    228  1.1.2.4  cliff 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
    229  1.1.2.1  cliff 	INT_S	a1, CPU_INFO_CPL(a3)		## save IPL in cpu_info
    230  1.1.2.4  cliff 						## interrupts remain disabled!
    231  1.1.2.1  cliff #ifdef PARANOIA
    232  1.1.2.1  cliff 	j	ra				# return
    233  1.1.2.1  cliff 	 nop
    234  1.1.2.1  cliff #endif /* PARANOIA */
    235  1.1.2.1  cliff 1:
    236  1.1.2.1  cliff #ifdef PARANOIA
    237  1.1.2.1  cliff 	dmfc0	v1, RMIXL_COP_0_EIMR		# load EIMR
    238  1.1.2.1  cliff 2:	bnez	v1, 2b				# loop forever if not 0.
    239  1.1.2.1  cliff 	 nop
    240  1.1.2.1  cliff #endif /* PARANOIA */
    241  1.1.2.1  cliff 	j	ra				## return
    242  1.1.2.1  cliff 	 nop
    243  1.1.2.1  cliff END(_splsw_splhigh)
    244  1.1.2.1  cliff 
    245  1.1.2.3  cliff STATIC_LEAF(_splsw_splddb)
    246  1.1.2.3  cliff 	REG_L	a0, _C_LABEL(ipl_eimr_map) + 8*IPL_DDB
    247  1.1.2.3  cliff 	li	a1, IPL_DDB
    248  1.1.2.3  cliff 	b	_splraise
    249  1.1.2.3  cliff 	 nop
    250  1.1.2.3  cliff END(_splsw_splddb)
    251  1.1.2.3  cliff 
    252  1.1.2.1  cliff STATIC_LEAF(_splsw_splsched)
    253  1.1.2.1  cliff 	REG_L	a0, _C_LABEL(ipl_eimr_map) + 8*IPL_SCHED
    254  1.1.2.1  cliff 	li	a1, IPL_SCHED
    255  1.1.2.1  cliff 	b	_splraise
    256  1.1.2.1  cliff 	 nop
    257  1.1.2.1  cliff END(_splsw_splsched)
    258  1.1.2.1  cliff 
    259  1.1.2.1  cliff STATIC_LEAF(_splsw_splvm)
    260  1.1.2.1  cliff 	REG_L	a0, _C_LABEL(ipl_eimr_map) + 8*IPL_VM
    261  1.1.2.1  cliff 	li	a1, IPL_VM
    262  1.1.2.1  cliff 	b	_splraise
    263  1.1.2.2  cliff 	 nop
    264  1.1.2.1  cliff END(_splsw_splvm)
    265  1.1.2.1  cliff 
    266  1.1.2.1  cliff STATIC_LEAF(_splsw_splsoftserial)
    267  1.1.2.1  cliff 	REG_L	a0, _C_LABEL(ipl_eimr_map) + 8*IPL_SOFTSERIAL
    268  1.1.2.1  cliff 	li	a1, IPL_SOFTSERIAL
    269  1.1.2.1  cliff 	b	_splraise
    270  1.1.2.1  cliff 	 nop
    271  1.1.2.1  cliff END(_splsw_splsoftserial)
    272  1.1.2.1  cliff 
    273  1.1.2.1  cliff STATIC_LEAF(_splsw_splsoftnet)
    274  1.1.2.1  cliff 	REG_L	a0, _C_LABEL(ipl_eimr_map) + 8*IPL_SOFTNET
    275  1.1.2.1  cliff 	li	a1, IPL_SOFTNET
    276  1.1.2.1  cliff 	b	_splraise
    277  1.1.2.1  cliff 	 nop
    278  1.1.2.1  cliff END(_splsw_splsoftnet)
    279  1.1.2.1  cliff 
    280  1.1.2.1  cliff STATIC_LEAF(_splsw_splsoftbio)
    281  1.1.2.1  cliff 	REG_L	a0, _C_LABEL(ipl_eimr_map) + 8*IPL_SOFTBIO
    282  1.1.2.1  cliff 	li	a1, IPL_SOFTBIO
    283  1.1.2.1  cliff 	b	_splraise
    284  1.1.2.1  cliff 	 nop
    285  1.1.2.1  cliff END(_splsw_splsoftbio)
    286  1.1.2.1  cliff 
    287  1.1.2.1  cliff STATIC_LEAF(_splsw_splsoftclock)
    288  1.1.2.1  cliff 	REG_L	a0, _C_LABEL(ipl_eimr_map) + 8*IPL_SOFTCLOCK
    289  1.1.2.1  cliff 	li	a1, IPL_SOFTCLOCK
    290  1.1.2.1  cliff 	b	_splraise
    291  1.1.2.1  cliff 	 nop
    292  1.1.2.1  cliff END(_splsw_splsoftclock)
    293  1.1.2.1  cliff 
    294  1.1.2.1  cliff STATIC_LEAF(_splsw_splintr)
    295  1.1.2.1  cliff 	dmfc0	ta1, RMIXL_COP_0_EIRR		# get active interrupts
    296  1.1.2.1  cliff 						# restrict to hard int bits:
    297  1.1.2.3  cliff 	and	v1, ta1, RMIXL_SOFT_INT_MASK	#  v1 = ta1 & ~RMIXL_SOFT_INT_MASK
    298  1.1.2.3  cliff 	xor	v1, ta1				#   "       "
    299  1.1.2.1  cliff 
    300  1.1.2.3  cliff 	li	v0, IPL_NONE
    301  1.1.2.1  cliff 	PTR_LA	ta3, _C_LABEL(ipl_eimr_map) + 8*IPL_VM
    302  1.1.2.1  cliff 	REG_L	ta2, -8(ta3)			# load 'enabled' bits for IPL_SOFTSERIAL
    303  1.1.2.1  cliff 	and	v1, ta2				# apply to pending bits
    304  1.1.2.3  cliff 	beq	v1, zero, 4f			# if nothing pending...
    305  1.1.2.3  cliff 	 nop					# ... return IPL_NONE
    306  1.1.2.1  cliff 
    307  1.1.2.3  cliff 	li	v0, IPL_VM			# ipl=IPL_VM
    308  1.1.2.1  cliff 1:
    309  1.1.2.3  cliff 	REG_L	ta2, (ta3)			# load 'enabled' bits for ipl
    310  1.1.2.1  cliff 	and	ta2, v1				# any match to pending intrs?
    311  1.1.2.1  cliff 	beq	ta2, zero, 2f			#  no, return ipl
    312  1.1.2.3  cliff 	 PTR_ADDI ta3, 1 << MAP_SCALESHIFT	#  point to next entry
    313  1.1.2.3  cliff 	addiu	v0, 1				# ipl++
    314  1.1.2.3  cliff 	move	v1, ta2				# update highest pending
    315  1.1.2.3  cliff 	b	1b				# loop
    316  1.1.2.4  cliff 	 nop
    317  1.1.2.1  cliff 
    318  1.1.2.1  cliff 2:
    319  1.1.2.1  cliff 	/*
    320  1.1.2.1  cliff 	 * Emulate the CP0_SR 'IM' bits in 'pending'
    321  1.1.2.1  cliff 	 * - if clock intr is requested, set MIPS_INT_MASK_5
    322  1.1.2.1  cliff 	 * - if other HW intr is requested, set MIPS_INT_MASK_1 as summary bit
    323  1.1.2.1  cliff 	 *   the RMI evbmips_iointr function will sort through
    324  1.1.2.1  cliff 	 *   individial EIRR requests
    325  1.1.2.1  cliff 	 */
    326  1.1.2.3  cliff 	li	t2, RMIXL_INT_MASK_5		# load RMIXL_INT_MASK_5
    327  1.1.2.1  cliff 	and	t1, v1, t2			# save count/compare intr request value
    328  1.1.2.1  cliff 	nor	t0, zero, t2			# invert the mask
    329  1.1.2.1  cliff 	and	v1, t0				# v1 &= ~RMIXL_INT_MASK_5
    330  1.1.2.1  cliff 	beq	v1, zero, 3f			# no non-clock intrs? skip ahead
    331  1.1.2.1  cliff 	 li	v1, RMIXL_INT_MASK_1		# use INT_MASK_1 as 'summary' bit
    332  1.1.2.1  cliff 						#  for non-clock hw intrs
    333  1.1.2.1  cliff 3:
    334  1.1.2.1  cliff 	or	v1, t1				# combine clock and non-clock-summary
    335  1.1.2.1  cliff 	sll	v1, MIPS_INT_MASK_SHIFT		# shift to emulate COP0_SR 'IM' bits
    336  1.1.2.1  cliff 4:
    337  1.1.2.1  cliff 	INT_S	v1, (a0)			# set a (fake) new pending mask
    338  1.1.2.1  cliff 	j	ra				# and return highest ipl pending
    339  1.1.2.1  cliff 	 nop
    340  1.1.2.1  cliff END(_splsw_splintr)
    341  1.1.2.1  cliff 
    342  1.1.2.1  cliff STATIC_LEAF(_splsw_splcheck)
    343  1.1.2.1  cliff #ifdef PARANOIA
    344  1.1.2.1  cliff 	PTR_L	t0, L_CPU(MIPS_CURLWP)
    345  1.1.2.1  cliff 	INT_L	t1, CPU_INFO_CPL(t0)		# get current priority level
    346  1.1.2.1  cliff 
    347  1.1.2.1  cliff 	dmfc0	t0, RMIXL_COP_0_EIMR		# get current EIMR
    348  1.1.2.1  cliff 
    349  1.1.2.1  cliff 	PTR_LA	t2, _C_LABEL(ipl_eimr_map)
    350  1.1.2.1  cliff 	sll	t1, MAP_SCALESHIFT		# shift cpl to array index
    351  1.1.2.1  cliff 	PTR_ADDU t2, t1
    352  1.1.2.1  cliff 	REG_L	t3, (t2)			# load value
    353  1.1.2.1  cliff 1:	bne	t0, t3, 1b			# loop forever if not equal
    354  1.1.2.1  cliff 	 nop
    355  1.1.2.1  cliff #endif /* PARANOIA */
    356  1.1.2.1  cliff 	j	ra
    357  1.1.2.1  cliff 	 nop
    358  1.1.2.1  cliff END(_splsw_splcheck)
    359  1.1.2.1  cliff 
    360  1.1.2.1  cliff 	.rdata
    361  1.1.2.1  cliff 	.globl _C_LABEL(rmixl_splsw)
    362  1.1.2.1  cliff _C_LABEL(rmixl_splsw):
    363  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splhigh)
    364  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splsched)
    365  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splvm)
    366  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splsoftserial)
    367  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splsoftnet)
    368  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splsoftbio)
    369  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splsoftclock)
    370  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splraise)
    371  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_spl0)
    372  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splx)
    373  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splhigh_noprof)
    374  1.1.2.1  cliff         PTR_WORD _C_LABEL(_splsw_splx_noprof)
    375  1.1.2.1  cliff 	PTR_WORD _C_LABEL(_splsw_setsoftintr)
    376  1.1.2.1  cliff 	PTR_WORD _C_LABEL(_splsw_clrsoftintr)
    377  1.1.2.1  cliff 	PTR_WORD _C_LABEL(_splsw_splintr)
    378  1.1.2.1  cliff 	PTR_WORD _C_LABEL(_splsw_splcheck)
    379