2005-04-17 02:20:36 +04: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 .
* Copyright ( C ) 2 0 0 3 B e n j a m i n 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 / p a g e . 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 >
2005-09-09 22:57:26 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-17 02:20:36 +04:00
# include < a s m / c a c h e . h >
2009-03-19 06:55:41 +03:00
# include < a s m / m m u . h >
2005-04-17 02:20:36 +04:00
_ GLOBAL( _ _ s e t u p _ c p u _ 6 0 3 )
2011-01-20 23:35:23 +03:00
mflr r5
2009-03-19 06:55:41 +03:00
BEGIN_ M M U _ F T R _ S E C T I O N
li r10 ,0
2009-07-15 00:52:54 +04:00
mtspr S P R N _ S P R G _ 6 0 3 _ L R U ,r10 / * i n i t S W L R U t r a c k i n g * /
2009-03-19 06:55:41 +03:00
END_ M M U _ F T R _ S E C T I O N _ I F S E T ( M M U _ F T R _ N E E D _ D T L B _ S W _ L R U )
2008-04-21 23:09:44 +04:00
BEGIN_ F T R _ S E C T I O N
bl _ _ i n i t _ f p u _ r e g i s t e r s
END_ F T R _ S E C T I O N _ I F C L R ( C P U _ F T R _ F P U _ U N A V A I L A B L E )
bl s e t u p _ c o m m o n _ c a c h e s
2011-01-20 23:35:23 +03:00
mtlr r5
2008-04-21 23:09:44 +04:00
blr
2005-04-17 02:20:36 +04:00
_ GLOBAL( _ _ s e t u p _ c p u _ 6 0 4 )
2011-01-20 23:35:23 +03:00
mflr r5
2005-04-17 02:20:36 +04:00
bl s e t u p _ c o m m o n _ c a c h e s
bl s e t u p _ 6 0 4 _ h i d0
2011-01-20 23:35:23 +03:00
mtlr r5
2005-04-17 02:20:36 +04:00
blr
_ GLOBAL( _ _ s e t u p _ c p u _ 7 5 0 )
2011-01-20 23:35:23 +03:00
mflr r5
2005-05-01 19:58:40 +04:00
bl _ _ i n i t _ f p u _ r e g i s t e r s
2005-04-17 02:20:36 +04:00
bl s e t u p _ c o m m o n _ c a c h e s
bl s e t u p _ 7 5 0 _ 7 4 0 0 _ h i d0
2011-01-20 23:35:23 +03:00
mtlr r5
2005-04-17 02:20:36 +04:00
blr
_ GLOBAL( _ _ s e t u p _ c p u _ 7 5 0 c x )
2011-01-20 23:35:23 +03:00
mflr r5
2005-05-01 19:58:40 +04:00
bl _ _ i n i t _ f p u _ r e g i s t e r s
2005-04-17 02:20:36 +04:00
bl s e t u p _ c o m m o n _ c a c h e s
bl s e t u p _ 7 5 0 _ 7 4 0 0 _ h i d0
bl s e t u p _ 7 5 0 c x
2011-01-20 23:35:23 +03:00
mtlr r5
2005-04-17 02:20:36 +04:00
blr
_ GLOBAL( _ _ s e t u p _ c p u _ 7 5 0 f x )
2011-01-20 23:35:23 +03:00
mflr r5
2005-05-01 19:58:40 +04:00
bl _ _ i n i t _ f p u _ r e g i s t e r s
2005-04-17 02:20:36 +04:00
bl s e t u p _ c o m m o n _ c a c h e s
bl s e t u p _ 7 5 0 _ 7 4 0 0 _ h i d0
bl s e t u p _ 7 5 0 f x
2011-01-20 23:35:23 +03:00
mtlr r5
2005-04-17 02:20:36 +04:00
blr
_ GLOBAL( _ _ s e t u p _ c p u _ 7 4 0 0 )
2011-01-20 23:35:23 +03:00
mflr r5
2005-05-01 19:58:40 +04:00
bl _ _ i n i t _ f p u _ r e g i s t e r s
2005-04-17 02:20:36 +04:00
bl s e t u p _ 7 4 0 0 _ w o r k a r o u n d s
bl s e t u p _ c o m m o n _ c a c h e s
bl s e t u p _ 7 5 0 _ 7 4 0 0 _ h i d0
2011-01-20 23:35:23 +03:00
mtlr r5
2005-04-17 02:20:36 +04:00
blr
_ GLOBAL( _ _ s e t u p _ c p u _ 7 4 1 0 )
2011-01-20 23:35:23 +03:00
mflr r5
2005-05-01 19:58:40 +04:00
bl _ _ i n i t _ f p u _ r e g i s t e r s
2005-04-17 02:20:36 +04:00
bl s e t u p _ 7 4 1 0 _ w o r k a r o u n d s
bl s e t u p _ c o m m o n _ c a c h e s
bl s e t u p _ 7 5 0 _ 7 4 0 0 _ h i d0
li r3 ,0
mtspr S P R N _ L 2 C R 2 ,r3
2011-01-20 23:35:23 +03:00
mtlr r5
2005-04-17 02:20:36 +04:00
blr
_ GLOBAL( _ _ s e t u p _ c p u _ 7 4 5 x )
2011-01-20 23:35:23 +03:00
mflr r5
2005-04-17 02:20:36 +04:00
bl s e t u p _ c o m m o n _ c a c h e s
bl s e t u p _ 7 4 5 x _ s p e c i f i c s
2011-01-20 23:35:23 +03:00
mtlr r5
2005-04-17 02:20:36 +04:00
blr
/* Enable caches for 603's, 604, 750 & 7400 */
setup_common_caches :
mfspr r11 ,S P R N _ H I D 0
andi. r0 ,r11 ,H I D 0 _ D C E
ori r11 ,r11 ,H I D 0 _ I C E | H I D 0 _ D C E
ori r8 ,r11 ,H I D 0 _ I C F I
bne 1 f / * d o n ' t i n v a l i d a t e t h e D - c a c h e * /
ori r8 ,r8 ,H I D 0 _ D C I / * u n l e s s i t w a s n ' t e n a b l e d * /
1 : sync
2005-05-01 19:58:40 +04:00
mtspr S P R N _ H I D 0 ,r8 / * e n a b l e a n d i n v a l i d a t e c a c h e s * /
2005-04-17 02:20:36 +04:00
sync
mtspr S P R N _ H I D 0 ,r11 / * e n a b l e c a c h e s * /
sync
isync
blr
/ * 6 0 4 , 6 0 4 e, 6 0 4 e v , . . .
* Enable s u p e r s c a l a r e x e c u t i o n & b r a n c h h i s t o r y t a b l e
* /
setup_604_hid0 :
mfspr r11 ,S P R N _ H I D 0
ori r11 ,r11 ,H I D 0 _ S I E D | H I D 0 _ B H T E
ori r8 ,r11 ,H I D 0 _ B T C D
sync
mtspr S P R N _ H I D 0 ,r8 / * f l u s h b r a n c h t a r g e t a d d r e s s c a c h e * /
sync / * o n 6 0 4 e / 6 0 4 r * /
mtspr S P R N _ H I D 0 ,r11
sync
isync
blr
/ * 7 4 0 0 < = rev 2 . 7 a n d 7 4 1 0 r e v = 1 . 0 s u f f e r f r o m s o m e
* erratas w e w o r k a r o u n d h e r e .
* Moto M P C 7 1 0 C E . p d f d e s c r i b e s t h e m , t h o s e a r e e r r a t a
* # 3 , # 4 and #5
* Note t h a t w e a s s u m e t h e f i r m w a r e d i d n ' t c h o o s e t o
* apply o t h e r w o r k a r o u n d s ( t h e r e a r e o t h e r o n e s d o c u m e n t e d
* in t h e . p d f ) . I t a p p e a r t h a t A p p l e f i r m w a r e o n l y w o r k s
* around #3 a n d w i t h t h e s a m e f i x w e u s e . W e m a y w a n t t o
* check i f t h e C P U i s u s i n g 6 0 x b u s m o d e i n w h i c h c a s e
* the w o r k a r o u n d f o r e r r a t a #4 i s u s e l e s s . A l s o , w e m a y
2007-10-20 01:22:55 +04:00
* want t o e x p l i c i t l y c l e a r H I D 0 _ N O P D S T a s t h i s i s n o t
2005-04-17 02:20:36 +04:00
* needed o n c e w e h a v e a p p l i e d w o r k a r o u n d #5 ( t h o u g h i t ' s
* not s e t b y A p p l e ' s f i r m w a r e a t l e a s t ) .
* /
setup_7400_workarounds :
mfpvr r3
rlwinm r3 ,r3 ,0 ,2 0 ,3 1
cmpwi 0 ,r3 ,0 x02 0 7
ble 1 f
blr
setup_7410_workarounds :
mfpvr r3
rlwinm r3 ,r3 ,0 ,2 0 ,3 1
cmpwi 0 ,r3 ,0 x01 0 0
bnelr
1 :
mfspr r11 ,S P R N _ M S S S R 0
/* Errata #3: Set L1OPQ_SIZE to 0x10 */
rlwinm r11 ,r11 ,0 ,9 ,6
oris r11 ,r11 ,0 x01 0 0
/* Errata #4: Set L2MQ_SIZE to 1 (check for MPX mode first ?) */
oris r11 ,r11 ,0 x00 0 2
/* Errata #5: Set DRLT_SIZE to 0x01 */
rlwinm r11 ,r11 ,0 ,5 ,2
oris r11 ,r11 ,0 x08 0 0
sync
mtspr S P R N _ M S S S R 0 ,r11
sync
isync
blr
/ * 7 4 0 / 7 5 0 / 7 4 0 0 / 7 4 1 0
* Enable S t o r e G a t h e r i n g ( S G E ) , A d d r e s s B r o d c a s t ( A B E ) ,
* Branch H i s t o r y T a b l e ( B H T E ) , B r a n c h T a r g e t I C a c h e ( B T I C )
* Dynamic P o w e r M a n a g e m e n t ( D P M ) , S p e c u l a t i v e ( S P D )
* Clear I n s t r u c t i o n c a c h e t h r o t t l i n g ( I C T C )
* /
setup_750_7400_hid0 :
mfspr r11 ,S P R N _ H I D 0
ori r11 ,r11 ,H I D 0 _ S G E | H I D 0 _ A B E | H I D 0 _ B H T E | H I D 0 _ B T I C
2005-05-01 19:58:40 +04:00
oris r11 ,r11 ,H I D 0 _ D P M @h
2005-04-17 02:20:36 +04:00
BEGIN_ F T R _ S E C T I O N
2005-05-01 19:58:40 +04:00
xori r11 ,r11 ,H I D 0 _ B T I C
END_ F T R _ S E C T I O N _ I F S E T ( C P U _ F T R _ N O _ B T I C )
BEGIN_ F T R _ S E C T I O N
xoris r11 ,r11 ,H I D 0 _ D P M @h /* disable dynamic power mgmt */
END_ F T R _ S E C T I O N _ I F S E T ( C P U _ F T R _ N O _ D P M )
2005-04-17 02:20:36 +04:00
li r3 ,H I D 0 _ S P D
andc r11 ,r11 ,r3 / * c l e a r S P D : e n a b l e s p e c u l a t i v e * /
li r3 ,0
mtspr S P R N _ I C T C ,r3 / * I n s t r u c t i o n C a c h e T h r o t t l i n g o f f * /
isync
mtspr S P R N _ H I D 0 ,r11
sync
isync
blr
/ * 7 5 0 cx s p e c i f i c
* Looks l i k e w e h a v e t o d i s a b l e N A P f e a t u r e f o r s o m e P L L s e t t i n g s . . .
* ( waiting f o r c o n f i r m a t i o n )
* /
setup_750cx :
mfspr r10 , S P R N _ H I D 1
rlwinm r10 ,r10 ,4 ,2 8 ,3 1
cmpwi c r0 ,r10 ,7
cmpwi c r1 ,r10 ,9
cmpwi c r2 ,r10 ,1 1
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r1 + e q
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r2 + e q
bnelr
2011-01-20 23:35:23 +03:00
lwz r6 ,C P U _ S P E C _ F E A T U R E S ( r4 )
2005-04-17 02:20:36 +04:00
li r7 ,C P U _ F T R _ C A N _ N A P
andc r6 ,r6 ,r7
2011-01-20 23:35:23 +03:00
stw r6 ,C P U _ S P E C _ F E A T U R E S ( r4 )
2005-04-17 02:20:36 +04:00
blr
/ * 7 5 0 fx s p e c i f i c
* /
setup_750fx :
blr
/ * MPC 7 4 5 x
* Enable S t o r e G a t h e r i n g ( S G E ) , B r a n c h F o l d i n g ( F O L D )
* Branch H i s t o r y T a b l e ( B H T E ) , B r a n c h T a r g e t I C a c h e ( B T I C )
* Dynamic P o w e r M a n a g e m e n t ( D P M ) , S p e c u l a t i v e ( S P D )
* Ensure o u r d a t a c a c h e i n s t r u c t i o n s r e a l l y o p e r a t e .
* Timebase h a s t o b e r u n n i n g o r w e w o u l d n ' t h a v e m a d e i t h e r e ,
* just e n s u r e w e d o n ' t d i s a b l e i t .
* Clear I n s t r u c t i o n c a c h e t h r o t t l i n g ( I C T C )
* Enable L 2 H W p r e f e t c h
* /
setup_745x_specifics :
/ * We c h e c k f o r t h e p r e s e n c e o f a n L 3 c a c h e s e t u p b y
* the f i r m w a r e . I f a n y , w e d i s a b l e N A P c a p a b i l i t y a s
* it' s k n o w n t o b e b o g u s o n r e v 2 . 1 a n d e a r l i e r
* /
2006-06-18 02:49:42 +04:00
BEGIN_ F T R _ S E C T I O N
2005-04-17 02:20:36 +04:00
mfspr r11 ,S P R N _ L 3 C R
andis. r11 ,r11 ,L 3 C R _ L 3 E @h
beq 1 f
2006-06-18 02:49:42 +04:00
END_ F T R _ S E C T I O N _ I F S E T ( C P U _ F T R _ L 3 C R )
2011-01-20 23:35:23 +03:00
lwz r6 ,C P U _ S P E C _ F E A T U R E S ( r4 )
2005-04-17 02:20:36 +04:00
andi. r0 ,r6 ,C P U _ F T R _ L 3 _ D I S A B L E _ N A P
beq 1 f
li r7 ,C P U _ F T R _ C A N _ N A P
andc r6 ,r6 ,r7
2011-01-20 23:35:23 +03:00
stw r6 ,C P U _ S P E C _ F E A T U R E S ( r4 )
2005-04-17 02:20:36 +04:00
1 :
mfspr r11 ,S P R N _ H I D 0
/ * All o f t h e b i t s w e h a v e t o s e t . . . . .
* /
2005-05-01 19:58:40 +04:00
ori r11 ,r11 ,H I D 0 _ S G E | H I D 0 _ F O L D | H I D 0 _ B H T E
ori r11 ,r11 ,H I D 0 _ L R S T K | H I D 0 _ B T I C
oris r11 ,r11 ,H I D 0 _ D P M @h
2009-06-06 15:12:36 +04:00
BEGIN_ M M U _ F T R _ S E C T I O N
oris r11 ,r11 ,H I D 0 _ H I G H _ B A T @h
END_ M M U _ F T R _ S E C T I O N _ I F S E T ( M M U _ F T R _ U S E _ H I G H _ B A T S )
2005-04-17 02:20:36 +04:00
BEGIN_ F T R _ S E C T I O N
xori r11 ,r11 ,H I D 0 _ B T I C
END_ F T R _ S E C T I O N _ I F S E T ( C P U _ F T R _ N O _ B T I C )
BEGIN_ F T R _ S E C T I O N
2005-05-01 19:58:40 +04:00
xoris r11 ,r11 ,H I D 0 _ D P M @h /* disable dynamic power mgmt */
END_ F T R _ S E C T I O N _ I F S E T ( C P U _ F T R _ N O _ D P M )
2005-04-17 02:20:36 +04:00
/ * All o f t h e b i t s w e h a v e t o c l e a r . . . .
* /
li r3 ,H I D 0 _ S P D | H I D 0 _ N O P D S T | H I D 0 _ N O P T I
andc r11 ,r11 ,r3 / * c l e a r S P D : e n a b l e s p e c u l a t i v e * /
li r3 ,0
mtspr S P R N _ I C T C ,r3 / * I n s t r u c t i o n C a c h e T h r o t t l i n g o f f * /
isync
mtspr S P R N _ H I D 0 ,r11
sync
isync
2005-08-31 08:54:47 +04:00
/ * Enable L 2 H W p r e f e t c h , i f L 2 i s e n a b l e d
2005-04-17 02:20:36 +04:00
* /
2005-08-31 08:54:47 +04:00
mfspr r3 ,S P R N _ L 2 C R
andis. r3 ,r3 ,L 2 C R _ L 2 E @h
beqlr
2005-04-17 02:20:36 +04:00
mfspr r3 ,S P R N _ M S S C R 0
ori r3 ,r3 ,3
sync
mtspr S P R N _ M S S C R 0 ,r3
sync
isync
blr
2005-05-01 19:58:40 +04:00
/ *
* Initialize t h e F P U r e g i s t e r s . T h i s i s n e e d e d t o w o r k a r o u n d a n e r r a t a
* in s o m e 7 5 0 c p u s w h e r e u s i n g a n o t y e t i n i t i a l i z e d F P U r e g i s t e r a f t e r
* power o n r e s e t m a y h a n g t h e C P U
* /
_ GLOBAL( _ _ i n i t _ f p u _ r e g i s t e r s )
mfmsr r10
ori r11 ,r10 ,M S R _ F P
mtmsr r11
isync
addis r9 ,r3 ,e m p t y _ z e r o _ p a g e @ha
addi r9 ,r9 ,e m p t y _ z e r o _ p a g e @l
REST_ 3 2 F P R S ( 0 ,r9 )
sync
mtmsr r10
isync
blr
2005-04-17 02:20:36 +04:00
/* Definitions for the table use to save CPU states */
# define C S _ H I D 0 0
# define C S _ H I D 1 4
# define C S _ H I D 2 8
# define C S _ M S S C R 0 1 2
# define C S _ M S S S R 0 1 6
# define C S _ I C T R L 2 0
# define C S _ L D S T C R 2 4
# define C S _ L D S T D B 2 8
# define C S _ S I Z E 3 2
.data
2005-10-17 05:50:32 +04:00
.balign L1_CACHE_BYTES
2005-04-17 02:20:36 +04:00
cpu_state_storage :
.space CS_SIZE
2005-10-17 05:50:32 +04:00
.balign L1 _ C A C H E _ B Y T E S ,0
2005-04-17 02:20:36 +04:00
.text
/ * Called i n n o r m a l c o n t e x t t o b a c k u p C P U 0 s t a t e . T h i s
* does n o t i n c l u d e c a c h e s e t t i n g s . T h i s f u n c t i o n i s a l s o
* called f o r m a c h i n e s l e e p . T h i s d o e s n o t i n c l u d e t h e M M U
* setup, B A T s , e t c . . . b u t r a t h e r t h e " s p e c i a l " r e g i s t e r s
* like H I D 0 , H I D 1 , M S S C R 0 , e t c . . .
* /
_ GLOBAL( _ _ s a v e _ c p u _ s e t u p )
/* Some CR fields are volatile, we back it up all */
mfcr r7
/* Get storage ptr */
lis r5 ,c p u _ s t a t e _ s t o r a g e @h
ori r5 ,r5 ,c p u _ s t a t e _ s t o r a g e @l
/* Save HID0 (common to all CONFIG_6xx cpus) */
mfspr r3 ,S P R N _ H I D 0
stw r3 ,C S _ H I D 0 ( r5 )
/* Now deal with CPU type dependent registers */
mfspr r3 ,S P R N _ P V R
srwi r3 ,r3 ,1 6
cmplwi c r0 ,r3 ,0 x80 0 0 / * 7 4 5 0 * /
cmplwi c r1 ,r3 ,0 x00 0 c / * 7 4 0 0 * /
cmplwi c r2 ,r3 ,0 x80 0 c / * 7 4 1 0 * /
cmplwi c r3 ,r3 ,0 x80 0 1 / * 7 4 5 5 * /
cmplwi c r4 ,r3 ,0 x80 0 2 / * 7 4 5 7 * /
cmplwi c r5 ,r3 ,0 x80 0 3 / * 7 4 4 7 A * /
cmplwi c r6 ,r3 ,0 x70 0 0 / * 7 5 0 F X * /
2005-09-04 02:55:55 +04:00
cmplwi c r7 ,r3 ,0 x80 0 4 / * 7 4 4 8 * /
2005-04-17 02:20:36 +04:00
/* cr1 is 7400 || 7410 */
cror 4 * c r1 + e q ,4 * c r1 + e q ,4 * c r2 + e q
/* cr0 is 74xx */
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r3 + e q
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r4 + e q
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r1 + e q
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r5 + e q
2005-09-04 02:55:55 +04:00
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r7 + e q
2005-04-17 02:20:36 +04:00
bne 1 f
/* Backup 74xx specific regs */
mfspr r4 ,S P R N _ M S S C R 0
stw r4 ,C S _ M S S C R 0 ( r5 )
mfspr r4 ,S P R N _ M S S S R 0
stw r4 ,C S _ M S S S R 0 ( r5 )
beq c r1 ,1 f
/* Backup 745x specific registers */
mfspr r4 ,S P R N _ H I D 1
stw r4 ,C S _ H I D 1 ( r5 )
mfspr r4 ,S P R N _ I C T R L
stw r4 ,C S _ I C T R L ( r5 )
mfspr r4 ,S P R N _ L D S T C R
stw r4 ,C S _ L D S T C R ( r5 )
mfspr r4 ,S P R N _ L D S T D B
stw r4 ,C S _ L D S T D B ( r5 )
1 :
bne c r6 ,1 f
/* Backup 750FX specific registers */
mfspr r4 ,S P R N _ H I D 1
stw r4 ,C S _ H I D 1 ( r5 )
/* If rev 2.x, backup HID2 */
mfspr r3 ,S P R N _ P V R
andi. r3 ,r3 ,0 x f f00
cmpwi c r0 ,r3 ,0 x02 0 0
bne 1 f
mfspr r4 ,S P R N _ H I D 2
stw r4 ,C S _ H I D 2 ( r5 )
1 :
mtcr r7
blr
/ * Called w i t h n o M M U c o n t e x t ( t y p i c a l l y M S R : I R / D R o f f ) t o
* restore C P U s t a t e a s b a c k e d u p b y t h e p r e v i o u s
* function. T h i s d o e s n o t i n c l u d e c a c h e s e t t i n g
* /
_ GLOBAL( _ _ r e s t o r e _ c p u _ s e t u p )
/* Some CR fields are volatile, we back it up all */
mfcr r7
/* Get storage ptr */
lis r5 ,( c p u _ s t a t e _ s t o r a g e - K E R N E L B A S E ) @h
ori r5 ,r5 ,c p u _ s t a t e _ s t o r a g e @l
/* Restore HID0 */
lwz r3 ,C S _ H I D 0 ( r5 )
sync
isync
mtspr S P R N _ H I D 0 ,r3
sync
isync
/* Now deal with CPU type dependent registers */
mfspr r3 ,S P R N _ P V R
srwi r3 ,r3 ,1 6
cmplwi c r0 ,r3 ,0 x80 0 0 / * 7 4 5 0 * /
cmplwi c r1 ,r3 ,0 x00 0 c / * 7 4 0 0 * /
cmplwi c r2 ,r3 ,0 x80 0 c / * 7 4 1 0 * /
cmplwi c r3 ,r3 ,0 x80 0 1 / * 7 4 5 5 * /
cmplwi c r4 ,r3 ,0 x80 0 2 / * 7 4 5 7 * /
cmplwi c r5 ,r3 ,0 x80 0 3 / * 7 4 4 7 A * /
cmplwi c r6 ,r3 ,0 x70 0 0 / * 7 5 0 F X * /
2005-09-04 02:55:55 +04:00
cmplwi c r7 ,r3 ,0 x80 0 4 / * 7 4 4 8 * /
2005-04-17 02:20:36 +04:00
/* cr1 is 7400 || 7410 */
cror 4 * c r1 + e q ,4 * c r1 + e q ,4 * c r2 + e q
/* cr0 is 74xx */
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r3 + e q
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r4 + e q
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r1 + e q
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r5 + e q
2005-09-04 02:55:55 +04:00
cror 4 * c r0 + e q ,4 * c r0 + e q ,4 * c r7 + e q
2005-04-17 02:20:36 +04:00
bne 2 f
/* Restore 74xx specific regs */
lwz r4 ,C S _ M S S C R 0 ( r5 )
sync
mtspr S P R N _ M S S C R 0 ,r4
sync
isync
lwz r4 ,C S _ M S S S R 0 ( r5 )
sync
mtspr S P R N _ M S S S R 0 ,r4
sync
isync
bne c r2 ,1 f
/* Clear 7410 L2CR2 */
li r4 ,0
mtspr S P R N _ L 2 C R 2 ,r4
1 : beq c r1 ,2 f
/* Restore 745x specific registers */
lwz r4 ,C S _ H I D 1 ( r5 )
sync
mtspr S P R N _ H I D 1 ,r4
isync
sync
lwz r4 ,C S _ I C T R L ( r5 )
sync
mtspr S P R N _ I C T R L ,r4
isync
sync
lwz r4 ,C S _ L D S T C R ( r5 )
sync
mtspr S P R N _ L D S T C R ,r4
isync
sync
lwz r4 ,C S _ L D S T D B ( r5 )
sync
mtspr S P R N _ L D S T D B ,r4
isync
sync
2 : bne c r6 ,1 f
/ * Restore 7 5 0 F X s p e c i f i c r e g i s t e r s
* that i s r e s t o r e H I D 2 o n r e v 2 . x a n d P L L c o n f i g & s w i t c h
* to P L L 0 o n a l l
* /
/* If rev 2.x, restore HID2 with low voltage bit cleared */
mfspr r3 ,S P R N _ P V R
andi. r3 ,r3 ,0 x f f00
cmpwi c r0 ,r3 ,0 x02 0 0
bne 4 f
lwz r4 ,C S _ H I D 2 ( r5 )
rlwinm r4 ,r4 ,0 ,1 9 ,1 7
mtspr S P R N _ H I D 2 ,r4
sync
4 :
lwz r4 ,C S _ H I D 1 ( r5 )
rlwinm r5 ,r4 ,0 ,1 6 ,1 4
mtspr S P R N _ H I D 1 ,r5
/* Wait for PLL to stabilize */
mftbl r5
3 : mftbl r6
sub r6 ,r6 ,r5
cmplwi c r0 ,r6 ,1 0 0 0 0
ble 3 b
/* Setup final PLL */
mtspr S P R N _ H I D 1 ,r4
1 :
mtcr r7
blr