2010-03-11 10:33:46 +03:00
/ *
2013-09-08 11:43:29 +04:00
* OMAP3 4 x x a n d O M A P 4 4 x x s e c u r e A P I s f i l e .
2010-03-11 10:33:46 +03:00
*
* Copyright ( C ) 2 0 1 0 T e x a s I n s t r u m e n t s , I n c .
* Written b y S a n t o s h S h i l i m k a r < s a n t o s h . s h i l i m k a r @ti.com>
*
2013-09-08 11:43:29 +04:00
* Copyright ( C ) 2 0 1 2 I v a y l o D i m i t r o v < f r e e m a n g o r d o n @abv.bg>
* Copyright ( C ) 2 0 1 3 P a l i R o h á r < p a l i . r o h a r @gmail.com>
2010-03-11 10:33:46 +03:00
*
* This p r o g r a m i s f r e e s o f t w a r e ,y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y
* it 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 L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
* /
# include < l i n u x / l i n k a g e . h >
/ *
* This i s c o m m o n r o u t i n e t o m a n a g e s e c u r e m o n i t o r A P I
* used t o m o d i f y t h e P L 3 1 0 s e c u r e r e g i s t e r s .
* ' r0 ' c o n t a i n s t h e v a l u e t o b e m o d i f i e d a n d ' r12 ' c o n t a i n s
* the m o n i t o r A P I n u m b e r . I t u s e s f e w C P U r e g i s t e r s
* internally a n d h e n c e t h e y n e e d b e b a c k e d u p i n c l u d i n g
* link r e g i s t e r " l r " .
* Function s i g n a t u r e : v o i d o m a p _ s m c1 ( u 3 2 f n , u 3 2 a r g )
* /
ENTRY( o m a p _ s m c1 )
stmfd s p ! , { r2 - r12 , l r }
mov r12 , r0
mov r0 , r1
dsb
2010-04-07 11:47:21 +04:00
smc #0
2010-03-11 10:33:46 +03:00
ldmfd s p ! , { r2 - r12 , p c }
2011-03-04 18:33:54 +03:00
ENDPROC( o m a p _ s m c1 )
2010-08-02 14:18:18 +04:00
2011-06-06 16:26:49 +04:00
/ * *
* u3 2 o m a p _ s m c2 ( u 3 2 i d , u 3 2 f a l g , u 3 2 p a r g s )
* Low l e v e l c o m m o n r o u t i n e f o r s e c u r e H A L a n d P P A A P I s .
* @id: Application ID of HAL APIs
* @flag: Flag to indicate the criticality of operation
* @pargs: Physical address of parameter list starting
* with n u m b e r o f p a r a m e t r s
* /
ENTRY( o m a p _ s m c2 )
stmfd s p ! , { r4 - r12 , l r }
mov r3 , r2
mov r2 , r1
mov r1 , #0x0 @ Process ID
mov r6 , #0xff
mov r12 , #0x00 @ Secure Service ID
mov r7 , #0
mcr p15 , 0 , r7 , c7 , c5 , 6
dsb
dmb
smc #0
ldmfd s p ! , { r4 - r12 , p c }
ENDPROC( o m a p _ s m c2 )
2013-09-08 11:43:29 +04:00
/ * *
* u3 2 o m a p _ s m c3 ( u 3 2 s e r v i c e _ i d , u 3 2 p r o c e s s _ i d , u 3 2 f l a g , u 3 2 p a r g s )
* Low l e v e l c o m m o n r o u t i n e f o r s e c u r e H A L a n d P P A A P I s v i a s m c #1
* r0 - @service_id: Secure Service ID
* r1 - @process_id: Process ID
* r2 - @flag: Flag to indicate the criticality of operation
* r3 - @pargs: Physical address of parameter list
* /
ENTRY( o m a p _ s m c3 )
stmfd s p ! , { r4 - r11 , l r }
mov r12 , r0 @ Copy the secure service ID
mov r6 , #0xff @ Indicate new Task call
dsb @ Memory Barrier (not sure if needed, copied from omap_smc2)
smc #1 @ Call PPA service
ldmfd s p ! , { r4 - r11 , p c }
ENDPROC( o m a p _ s m c3 )
2010-08-02 14:18:18 +04:00
ENTRY( o m a p _ m o d i f y _ a u x c o r e b o o t 0 )
stmfd s p ! , { r1 - r12 , l r }
ldr r12 , =0x104
dsb
smc #0
ldmfd s p ! , { r1 - r12 , p c }
2011-03-04 18:33:54 +03:00
ENDPROC( o m a p _ m o d i f y _ a u x c o r e b o o t 0 )
2010-08-02 14:18:18 +04:00
ENTRY( o m a p _ a u x c o r e b o o t _ a d d r )
stmfd s p ! , { r2 - r12 , l r }
ldr r12 , =0x105
dsb
smc #0
ldmfd s p ! , { r2 - r12 , p c }
2011-03-04 18:33:54 +03:00
ENDPROC( o m a p _ a u x c o r e b o o t _ a d d r )
2010-08-02 14:18:18 +04:00
ENTRY( o m a p _ r e a d _ a u x c o r e b o o t 0 )
stmfd s p ! , { r2 - r12 , l r }
ldr r12 , =0x103
dsb
smc #0
ldmfd s p ! , { r2 - r12 , p c }
2011-03-04 18:33:54 +03:00
ENDPROC( o m a p _ r e a d _ a u x c o r e b o o t 0 )