2009-01-08 17:31:20 +03: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 >
2012-07-09 16:55:31 +04:00
# include < a s m / m m u - b o o k 3 e . h >
# include < a s m / a s m - o f f s e t s . h >
2009-01-08 17:31:20 +03:00
2009-06-11 00:37:28 +04: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 17:32:11 +04:00
# ifdef C O N F I G _ P P C 3 2
2009-01-08 17:31:20 +03: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-11 00:37:28 +04: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
2011-03-24 02:43:03 +03:00
# ifdef C O N F I G _ F S L _ R I O
2010-11-03 12:36:37 +03:00
/* 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-11 00:37:28 +04:00
mtlr r4
blr
2009-01-08 17:31:20 +03:00
_ GLOBAL( _ _ s e t u p _ c p u _ e 5 0 0 m c )
2012-07-09 16:58:21 +04:00
_ GLOBAL( _ _ s e t u p _ c p u _ e 5 5 0 0 )
2012-07-09 16:55:31 +04:00
mflr r5
2009-06-11 00:37:28 +04:00
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
2012-07-09 16:55:31 +04:00
/ *
* We o n l y w a n t t o t o u c h I V O R 3 8 - 4 1 i f w e ' r e r u n n i n g o n h a r d w a r e
* that s u p p o r t s c a t e g o r y E . H V . T h e a r c h i t e c t u r a l w a y t o d e t e r m i n e
* this i s M M U C F G [ L P I D S I Z E ] .
* /
mfspr r3 , S P R N _ M M U C F G
rlwinm. r3 , r3 , 0 , M M U C F G _ L P I D S I Z E
beq 1 f
bl _ _ s e t u p _ e h v _ i v o r s
b 2 f
1 :
lwz r3 , C P U _ S P E C _ F E A T U R E S ( r4 )
/ * We n e e d t h i s c h e c k a s c p u _ s e t u p i s a l s o c a l l e d f o r
* the s e c o n d a r y c o r e s . S o , i f w e h a v e a l r e a d y c l e a r e d
* the f e a t u r e o n t h e p r i m a r y c o r e , a v o i d d o i n g i t o n t h e
* secondary c o r e .
* /
andis. r6 , r3 , C P U _ F T R _ E M B _ H V @h
beq 2 f
rlwinm r3 , r3 , 0 , ~ C P U _ F T R _ E M B _ H V
stw r3 , C P U _ S P E C _ F E A T U R E S ( r4 )
2 :
mtlr r5
2009-06-11 00:37:28 +04:00
blr
2010-10-08 17:32:11 +04:00
# endif
2012-07-09 17:01:51 +04:00
2012-07-09 16:58:21 +04:00
# ifdef C O N F I G _ P P C _ B O O K 3 E _ 6 4
2010-10-08 17:32:11 +04:00
_ GLOBAL( _ _ r e s t o r e _ 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
bl . _ _ s e t u p _ b a s e _ i v o r s
2011-05-10 01:26:00 +04:00
bl . s e t u p _ p e r f m o n _ i v o r
bl . s e t u p _ d o o r b e l l _ i v o r s
2012-07-09 17:01:51 +04:00
/ *
* We o n l y w a n t t o t o u c h I V O R 3 8 - 4 1 i f w e ' r e r u n n i n g o n h a r d w a r e
* that s u p p o r t s c a t e g o r y E . H V . T h e a r c h i t e c t u r a l w a y t o d e t e r m i n e
* this i s M M U C F G [ L P I D S I Z E ] .
* /
mfspr r10 ,S P R N _ M M U C F G
rlwinm. r10 ,r10 ,0 ,M M U C F G _ L P I D S I Z E
beq 1 f
2011-05-10 01:26:00 +04:00
bl . s e t u p _ e h v _ i v o r s
2012-07-09 17:01:51 +04:00
1 :
2010-10-08 17:32:11 +04:00
mtlr r4
blr
2012-07-09 17:01:51 +04:00
_ GLOBAL( _ _ s e t u p _ c p u _ e 5 5 0 0 )
mflr r5
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 _ b a s e _ i v o r s
bl . s e t u p _ p e r f m o n _ i v o r
bl . s e t u p _ d o o r b e l l _ i v o r s
/ *
* We o n l y w a n t t o t o u c h I V O R 3 8 - 4 1 i f w e ' r e r u n n i n g o n h a r d w a r e
* that s u p p o r t s c a t e g o r y E . H V . T h e a r c h i t e c t u r a l w a y t o d e t e r m i n e
* this i s M M U C F G [ L P I D S I Z E ] .
* /
mfspr r10 ,S P R N _ M M U C F G
rlwinm. r10 ,r10 ,0 ,M M U C F G _ L P I D S I Z E
beq 1 f
bl . s e t u p _ e h v _ i v o r s
1 :
mtlr r5
blr
2012-07-09 16:58:21 +04:00
# endif