2010-12-14 10:56:55 +03:00
/ *
* SMP s u p p o r t f o r R - M o b i l e / S H - M o b i l e
*
* Copyright ( C ) 2 0 1 0 M a g n u s D a m m
* Copyright ( C ) 2 0 1 0 T a k a s h i Y o s h i i
*
* Based o n v e x p r e s s , C o p y r i g h t ( c ) 2 0 0 3 A R M L i m i t e d , A l l R i g h t s R e s e r v e d
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* 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 / i n i t . h >
2014-06-06 11:20:10 +04:00
# include < l i n u x / l i n k a g e . h >
# include < l i n u x / t h r e a d s . h >
2014-06-30 19:29:12 +04:00
# include < a s m / a s s e m b l e r . h >
2010-12-20 14:04:50 +03:00
# include < a s m / m e m o r y . h >
2010-12-14 10:56:55 +03:00
/ *
* Reset v e c t o r f o r s e c o n d a r y C P U s .
* This w i l l b e m a p p e d a t a d d r e s s 0 b y S B A R r e g i s t e r .
* We n e e d _ l o n g _ j u m p t o t h e p h y s i c a l a d d r e s s .
* /
2013-07-10 05:56:36 +04:00
.arm
2010-12-14 10:56:55 +03:00
.align 12
2013-06-10 13:19:36 +04:00
ENTRY( s h m o b i l e _ b o o t _ v e c t o r )
2013-07-10 05:56:36 +04:00
ldr r1 , 1 f
bx r1
2013-06-10 13:19:36 +04:00
ENDPROC( s h m o b i l e _ b o o t _ v e c t o r )
2013-07-10 05:56:37 +04:00
.align 2
2013-06-10 13:19:36 +04:00
.globl shmobile_boot_fn
shmobile_boot_fn :
1 : .space 4
2013-08-08 02:14:07 +04:00
.globl shmobile_boot_size
shmobile_boot_size :
.long . - shmobile_ b o o t _ v e c t o r
2013-07-31 22:38:18 +04:00
/ *
* Per- C P U S M P b o o t f u n c t i o n / a r g u m e n t s e l e c t i o n c o d e b a s e d o n M P I D R
* /
ENTRY( s h m o b i l e _ s m p _ b o o t )
mrc p15 , 0 , r1 , c0 , c0 , 5 @ r1 = MPIDR
2016-02-15 15:20:08 +03:00
and r0 , r1 , #0xffffff @ MPIDR_HWID_BITMASK
@ r0 = cpu_logical_map() value
2013-07-31 22:38:18 +04:00
mov r1 , #0 @ r1 = CPU index
2016-02-15 15:20:07 +03:00
adr r2 , 1 f
ldmia r2 , { r5 , r6 , r7 }
add r5 , r5 , r2 @ array of per-cpu mpidr values
add r6 , r6 , r2 @ array of per-cpu functions
add r7 , r7 , r2 @ array of per-cpu arguments
2013-07-31 22:38:18 +04:00
shmobile_smp_boot_find_mpidr :
ldr r8 , [ r5 , r1 , l s l #2 ]
cmp r8 , r0
bne s h m o b i l e _ s m p _ b o o t _ n e x t
ldr r9 , [ r6 , r1 , l s l #2 ]
cmp r9 , #0
bne s h m o b i l e _ s m p _ b o o t _ f o u n d
shmobile_smp_boot_next :
add r1 , r1 , #1
2014-06-06 11:20:10 +04:00
cmp r1 , #N R _ C P U S
2013-07-31 22:38:18 +04:00
blo s h m o b i l e _ s m p _ b o o t _ f i n d _ m p i d r
b s h m o b i l e _ s m p _ s l e e p
shmobile_smp_boot_found :
ldr r0 , [ r7 , r1 , l s l #2 ]
2014-06-30 19:29:12 +04:00
ret r9
2013-07-31 22:38:18 +04:00
ENDPROC( s h m o b i l e _ s m p _ b o o t )
ENTRY( s h m o b i l e _ s m p _ s l e e p )
wfi
b s h m o b i l e _ s m p _ b o o t
ENDPROC( s h m o b i l e _ s m p _ s l e e p )
2016-02-15 15:20:07 +03:00
.align 2
1 : .long s h m o b i l e _ s m p _ m p i d r - .
.long shmobile_smp_fn - 1 b
.long shmobile_smp_arg - 1 b
.bss
2013-07-31 22:38:18 +04:00
.globl shmobile_smp_mpidr
shmobile_smp_mpidr :
2016-02-15 15:20:07 +03:00
.space NR_CPUS * 4
2013-07-31 22:38:18 +04:00
.globl shmobile_smp_fn
shmobile_smp_fn :
2016-02-15 15:20:07 +03:00
.space NR_CPUS * 4
2013-07-31 22:38:18 +04:00
.globl shmobile_smp_arg
shmobile_smp_arg :
2016-02-15 15:20:07 +03:00
.space NR_CPUS * 4