2009-01-08 08:31:20 -06:00
/ *
* This f i l e c o n t a i n s l o w l e v e l C P U s e t u p f u n c t i o n s .
* Kumar G a l a < g a l a k @kernel.crashing.org>
* Copyright 2 0 0 9 F r e e s c a l e S e m i c o n d u c t o r , I n c .
*
* Based o n c p u _ s e t u p _ 6 x x c o d e b y
* Benjamin H e r r e n s c h m i d t < b e n h @kernel.crashing.org>
*
* 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 i t 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
* as p u b l i s h e d 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 ; either version
* 2 of t h e L i c e n s e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
*
* /
# include < a s m / p r o c e s s o r . h >
# include < a s m / c p u t a b l e . h >
# include < a s m / p p c _ a s m . h >
2009-06-10 15:37:28 -05:00
_ GLOBAL( _ _ e 5 0 0 _ i c a c h e _ s e t u p )
mfspr r0 , S P R N _ L 1 C S R 1
andi. r3 , r0 , L 1 C S R 1 _ I C E
bnelr / * A l r e a d y e n a b l e d * /
oris r0 , r0 , L 1 C S R 1 _ C P E @h
ori r0 , r0 , ( L 1 C S R 1 _ I C F I | L 1 C S R 1 _ I C L F R | L 1 C S R 1 _ I C E )
mtspr S P R N _ L 1 C S R 1 , r0 / * E n a b l e I - C a c h e * /
isync
blr
_ GLOBAL( _ _ e 5 0 0 _ d c a c h e _ s e t u p )
mfspr r0 , S P R N _ L 1 C S R 0
andi. r3 , r0 , L 1 C S R 0 _ D C E
bnelr / * A l r e a d y e n a b l e d * /
msync
isync
li r0 , 0
mtspr S P R N _ L 1 C S R 0 , r0 / * D i s a b l e * /
msync
isync
li r0 , ( L 1 C S R 0 _ D C F I | L 1 C S R 0 _ C L F C )
mtspr S P R N _ L 1 C S R 0 , r0 / * I n v a l i d a t e * /
isync
1 : mfspr r0 , S P R N _ L 1 C S R 0
andi. r3 , r0 , L 1 C S R 0 _ C L F C
bne+ 1 b / * W a i t f o r l o c k b i t s r e s e t * /
oris r0 , r0 , L 1 C S R 0 _ C P E @h
ori r0 , r0 , L 1 C S R 0 _ D C E
msync
isync
mtspr S P R N _ L 1 C S R 0 , r0 / * E n a b l e * /
isync
blr
2010-10-08 08:32:11 -05:00
# ifdef C O N F I G _ P P C 3 2
2009-01-08 08:31:20 -06:00
_ GLOBAL( _ _ s e t u p _ c p u _ e 2 0 0 )
/* enable dedicated debug exception handling resources (Debug APU) */
mfspr r3 ,S P R N _ H I D 0
ori r3 ,r3 ,H I D 0 _ D A P U E N @l
mtspr S P R N _ H I D 0 ,r3
b _ _ s e t u p _ e 2 0 0 _ i v o r s
_ GLOBAL( _ _ s e t u p _ c p u _ e 5 0 0 v1 )
_ GLOBAL( _ _ s e t u p _ c p u _ e 5 0 0 v2 )
2009-06-10 15:37:28 -05:00
mflr r4
bl _ _ e 5 0 0 _ i c a c h e _ s e t u p
bl _ _ e 5 0 0 _ d c a c h e _ s e t u p
bl _ _ s e t u p _ e 5 0 0 _ i v o r s
2010-11-03 17:36:37 +08:00
# ifdef C O N F I G _ R A P I D I O
/* Ensure that RFXE is set */
mfspr r3 ,S P R N _ H I D 1
oris r3 ,r3 ,H I D 1 _ R F X E @h
mtspr S P R N _ H I D 1 ,r3
# endif
2009-06-10 15:37:28 -05:00
mtlr r4
blr
2009-01-08 08:31:20 -06:00
_ GLOBAL( _ _ s e t u p _ c p u _ e 5 0 0 m c )
2009-06-10 15:37:28 -05:00
mflr r4
bl _ _ e 5 0 0 _ i c a c h e _ s e t u p
bl _ _ e 5 0 0 _ d c a c h e _ s e t u p
bl _ _ s e t u p _ e 5 0 0 m c _ i v o r s
mtlr r4
blr
2010-10-08 08:32:11 -05:00
# endif
/* Right now, restore and setup are the same thing */
_ GLOBAL( _ _ r e s t o r e _ c p u _ e 5 5 0 0 )
_ GLOBAL( _ _ s e t u p _ c p u _ e 5 5 0 0 )
mflr r4
bl _ _ e 5 0 0 _ i c a c h e _ s e t u p
bl _ _ e 5 0 0 _ d c a c h e _ s e t u p
# ifdef C O N F I G _ P P C _ B O O K 3 E _ 6 4
bl . _ _ s e t u p _ b a s e _ i v o r s
# else
bl _ _ s e t u p _ e 5 0 0 m c _ i v o r s
# endif
mtlr r4
blr