2005-10-31 17:25:02 +03:00
/ *
2008-08-05 19:14:15 +04:00
* arch/ a r m / m a c h - r e a l v i e w / i n c l u d e / m a c h / e n t r y - m a c r o . S
2005-10-31 17:25:02 +03:00
*
* Low- l e v e l I R Q h e l p e r m a c r o s f o r R e a l V i e w p l a t f o r m s
*
* This f i l e i s l i c e n s e d u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c
* License v e r s i o n 2 . T h i s p r o g r a m i s l i c e n s e d " a s i s " w i t h o u t a n y
* warranty o f a n y k i n d , w h e t h e r e x p r e s s o r i m p l i e d .
* /
2008-08-05 19:14:15 +04:00
# include < m a c h / h a r d w a r e . h >
2005-10-31 17:25:02 +03:00
# include < a s m / h a r d w a r e / g i c . h >
.macro disable_fiq
.endm
2007-02-17 00:16:32 +03:00
.macro get_ i r q n r _ p r e a m b l e , b a s e , t m p
2008-02-04 19:41:01 +03:00
ldr \ b a s e , =gic_cpu_base_addr
ldr \ b a s e , [ \ b a s e ]
2007-02-17 00:16:32 +03:00
.endm
.macro arch_ r e t _ t o _ u s e r , t m p1 , t m p2
.endm
2005-10-31 17:25:02 +03:00
/ *
* The i n t e r r u p t n u m b e r i n g s c h e m e i s d e f i n e d i n t h e
* interrupt c o n t r o l l e r s p e c . T o w i t :
*
* Interrupts 0 - 1 5 a r e I P I
* 1 6 - 2 8 are r e s e r v e d
* 2 9 - 3 1 are l o c a l . W e a l l o w 3 0 t o b e u s e d f o r t h e w a t c h d o g .
* 3 2 - 1 0 2 0 are g l o b a l
* 1 0 2 1 - 1 0 2 2 are r e s e r v e d
* 1 0 2 3 is " s p u r i o u s " ( n o i n t e r r u p t )
*
* For n o w , w e i g n o r e a l l l o c a l i n t e r r u p t s s o o n l y r e t u r n a n i n t e r r u p t i f i t ' s
* between 3 0 a n d 1 0 2 0 . T h e t e s t _ f o r _ i p i r o u t i n e b e l o w w i l l p i c k u p o n I P I s .
*
* A s i m p l e r e a d f r o m t h e c o n t r o l l e r w i l l t e l l u s t h e n u m b e r o f t h e h i g h e s t
* priority e n a b l e d i n t e r r u p t . W e t h e n j u s t n e e d t o c h e c k w h e t h e r i t i s i n t h e
* valid r a n g e f o r a n I R Q ( 3 0 - 1 0 2 0 i n c l u s i v e ) .
* /
.macro get_ i r q n r _ a n d _ b a s e , i r q n r , i r q s t a t , b a s e , t m p
ldr \ i r q s t a t , [ \ b a s e , #G I C _ C P U _ I N T A C K ] / * b i t s 12 - 1 0 = s r c C P U , 9 - 0 = i n t # * /
ldr \ t m p , =1021
bic \ i r q n r , \ i r q s t a t , #0x1c00
cmp \ i r q n r , #29
cmpcc \ i r q n r , \ i r q n r
cmpne \ i r q n r , \ t m p
cmpcs \ i r q n r , \ i r q n r
.endm
2005-11-08 00:05:42 +03:00
/ * We a s s u m e t h a t i r q s t a t ( t h e r a w v a l u e o f t h e I R Q a c k n o w l e d g e
* register) i s p r e s e r v e d f r o m t h e m a c r o a b o v e .
* If t h e r e i s a n I P I , w e i m m e d i a t e l y s i g n a l e n d o f i n t e r r u p t o n t h e
* controller, s i n c e t h i s r e q u i r e s t h e o r i g i n a l i r q s t a t v a l u e w h i c h
* we w o n ' t e a s i l y b e a b l e t o r e c r e a t e l a t e r .
* /
.macro test_ f o r _ i p i , i r q n r , i r q s t a t , b a s e , t m p
bic \ i r q n r , \ i r q s t a t , #0x1c00
cmp \ i r q n r , #16
strcc \ i r q s t a t , [ \ b a s e , #G I C _ C P U _ E O I ]
cmpcs \ i r q n r , \ i r q n r
.endm
2005-11-09 13:50:29 +03:00
/* As above, this assumes that irqstat and base are preserved.. */
.macro test_ f o r _ l t i r q , i r q n r , i r q s t a t , b a s e , t m p
bic \ i r q n r , \ i r q s t a t , #0x1c00
mov \ t m p , #0
cmp \ i r q n r , #29
moveq \ t m p , #1
streq \ i r q s t a t , [ \ b a s e , #G I C _ C P U _ E O I ]
cmp \ t m p , #0
.endm