2005-04-17 02:20:36 +04:00
/ *
* EFI c a l l s t u b .
*
* Copyright ( C ) 1 9 9 9 - 2 0 0 1 H e w l e t t - P a c k a r d C o
* David M o s b e r g e r < d a v i d m @hpl.hp.com>
*
* This s t u b a l l o w s u s t o m a k e E F I c a l l s i n p h y s i c a l m o d e w i t h i n t e r r u p t s
* turned o f f . W e n e e d t h i s b e c a u s e w e c a n ' t c a l l S e t V i r t u a l M a p ( ) u n t i l
* the k e r n e l h a s b o o t e d f a r e n o u g h t o a l l o w a l l o c a t i o n o f s t r u c t v m a _ s t r u c t
* entries ( w h i c h w e w o u l d n e e d t o m a p s t u f f w i t h m e m o r y a t t r i b u t e s o t h e r
* than u n c a c h e d o r w r i t e b a c k . . . ) . S i n c e t h e G e t T i m e ( ) s e r v i c e g e t s c a l l e d
* earlier t h a n t h a t , w e n e e d t o b e a b l e t o m a k e p h y s i c a l m o d e E F I c a l l s f r o m
* the k e r n e l .
* /
/ *
* PSR s e t t i n g s a s p e r S A L s p e c ( C h a p t e r 8 i n t h e " I A - 6 4 S y s t e m
* Abstraction L a y e r S p e c i f i c a t i o n " , r e v i s i o n 2 . 6 e ) . N o t e t h a t
* psr. d f l a n d p s r . d f h M U S T b e c l e a r e d , d e s p i t e w h a t t h i s m a n u a l s a y s .
* Otherwise, S A L d i e s w h e n e v e r i t ' s t r y i n g t o d o a n I A - 3 2 B I O S c a l l
* ( the b r . i a i n s t r u c t i o n f a i l s u n l e s s p s r . d f l a n d p s r . d f h a r e
* cleared) . F o r t u n a t e l y , S A L p r o m i s e s n o t t o t o u c h t h e f l o a t i n g
* point r e g s , s o a t l e a s t w e d o n ' t h a v e t o s a v e f2 - f12 7 .
* /
# define P S R _ B I T S _ T O _ C L E A R \
( IA6 4 _ P S R _ I | I A 6 4 _ P S R _ I T | I A 6 4 _ P S R _ D T | I A 6 4 _ P S R _ R T | \
IA6 4 _ P S R _ D D | I A 6 4 _ P S R _ S S | I A 6 4 _ P S R _ R I | I A 6 4 _ P S R _ E D | \
IA6 4 _ P S R _ D F L | I A 6 4 _ P S R _ D F H )
# define P S R _ B I T S _ T O _ S E T \
( IA6 4 _ P S R _ B N )
# include < a s m / p r o c e s s o r . h >
# include < a s m / a s m m a c r o . h >
/ *
* Inputs :
* in0 = a d d r e s s o f f u n c t i o n d e s c r i p t o r o f E F I r o u t i n e t o c a l l
* in1 . . i n 7 = a r g u m e n t s t o r o u t i n e
*
* Outputs :
* r8 = E F I _ S T A T U S r e t u r n e d b y c a l l e d f u n c t i o n
* /
GLOBAL_ E N T R Y ( e f i _ c a l l _ p h y s )
.prologue ASM_ U N W _ P R L G _ R P | A S M _ U N W _ P R L G _ P F S , A S M _ U N W _ P R L G _ G R S A V E ( 8 )
alloc l o c1 =ar . p f s ,8 ,7 ,7 ,0
ld8 r2 = [ i n 0 ] ,8 / / l o a d E F I f u n c t i o n ' s e n t r y p o i n t
mov l o c0 =rp
.body
;;
mov l o c2 =gp / / s a v e g l o b a l p o i n t e r
mov l o c4 =ar . r s c / / s a v e R S E c o n f i g u r a t i o n
mov a r . r s c =0 / / p u t R S E i n e n f o r c e d l a z y , L E m o d e
;;
ld8 g p = [ i n 0 ] / / l o a d E F I f u n c t i o n ' s g l o b a l p o i n t e r
movl r16 =PSR_BITS_TO_CLEAR
mov l o c3 =psr / / s a v e p r o c e s s o r s t a t u s w o r d
movl r17 =PSR_BITS_TO_SET
;;
or l o c3 =loc3 ,r17
mov b6 =r2
;;
2006-05-25 08:16:03 +04:00
andcm r16 =loc3 ,r16 / / g e t p s r w i t h I T , D T , a n d R T b i t s c l e a r e d
2005-04-17 02:20:36 +04:00
br. c a l l . s p t k . m a n y r p =ia64_switch_mode_phys
.ret0 : mov o u t 4 =in5
mov o u t 0 =in1
mov o u t 1 =in2
mov o u t 2 =in3
mov o u t 3 =in4
mov o u t 5 =in6
mov o u t 6 =in7
mov l o c5 =r19
mov l o c6 =r20
br. c a l l . s p t k . m a n y r p =b6 / / c a l l t h e E F I f u n c t i o n
.ret1 : mov a r . r s c =0 / / p u t R S E i n e n f o r c e d l a z y , L E m o d e
mov r16 =loc3
mov r19 =loc5
mov r20 =loc6
br. c a l l . s p t k . m a n y r p =ia64_switch_mode_virt / / r e t u r n t o v i r t u a l m o d e
.ret2 : mov a r . r s c =loc4 / / r e s t o r e R S E c o n f i g u r a t i o n
mov a r . p f s =loc1
mov r p =loc0
mov g p =loc2
br. r e t . s p t k . m a n y r p
END( e f i _ c a l l _ p h y s )