@ -143,68 +143,8 @@ _start_e500:
li r1 ,0 x0 f00
mtspr I V O R 1 5 ,r1 / * 1 5 : D e b u g * /
/ *
* After r e s e t , C C S R B A R i s l o c a t e d a t C F G _ C C S R B A R _ D E F A U L T , i . e .
* 0 xff7 0 0 0 0 0 - 0 x f f80 0 0 0 0 . W e n e e d a d d a T L B 1 e n t r y f o r t h i s 1 M B
* region b e f o r e w e c a n a c c e s s a n y C C S R r e g i s t e r s s u c h a s L 2
* registers, L o c a l A c c e s s R e g i s t e r s ,e t c . W e w i l l a l s o r e - a l l o c a t e
* CFG_ C C S R B A R _ D E F A U L T t o C F G _ C C S R B A R i m m e d i a t e l y a f t e r T L B 1 s e t u p .
*
* Please r e f e r t o b o a r d - s p e c i f d i r e c t o r y f o r T L B 1 e n t r y c o n f i g u r a t i o n .
* ( e. g . b o a r d / < y o u r b o a r d > / i n i t . S )
*
* /
bl t l b1 _ e n t r y
mr r5 ,r0
lwzu r4 ,0 ( r5 ) / * h o w m a n y T L B 1 e n t r i e s w e a c t u a l l y u s e * /
mtctr r4
0 : lwzu r6 ,4 ( r5 )
lwzu r7 ,4 ( r5 )
lwzu r8 ,4 ( r5 )
lwzu r9 ,4 ( r5 )
mtspr M A S 0 ,r6
mtspr M A S 1 ,r7
mtspr M A S 2 ,r8
mtspr M A S 3 ,r9
isync
msync
tlbwe
isync
bdnz 0 b
1 :
# if ( C F G _ C C S R B A R _ D E F A U L T ! = C F G _ C C S R B A R )
/* Special sequence needed to update CCSRBAR itself */
lis r4 ,C F G _ C C S R B A R _ D E F A U L T @h
ori r4 ,r4 ,C F G _ C C S R B A R _ D E F A U L T @l
lis r5 ,C F G _ C C S R B A R @h
ori r5 ,r5 ,C F G _ C C S R B A R @l
srwi r6 ,r5 ,1 2
stw r6 ,0 ( r4 )
isync
lis r5 ,0 x f f f f
ori r5 ,r5 ,0 x f00 0
lwz r5 ,0 ( r5 )
isync
lis r3 ,C F G _ C C S R B A R @h
lwz r5 ,C F G _ C C S R B A R @l(r3)
isync
# endif
/* set up local access windows, defined at board/<boardname>/init.S */
lis r7 ,C F G _ C C S R B A R @h
ori r7 ,r7 ,C F G _ C C S R B A R @l
/* Clear and set up some registers. */
li r0 ,0
mtmsr r0
li r0 ,0 x00 0 0
li r0 ,0 x00 0 0
lis r1 ,0 x f f f f
mtspr D E C ,r0 / * p r e v e n t d e c e x c e p t i o n s * /
mttbl r0 / * p r e v e n t f i t & w d t e x c e p t i o n s * /
@ -214,18 +154,13 @@ _start_e500:
mtspr E S R ,r0 / * c l e a r e x c e p t i o n s y n d r o m e r e g i s t e r * /
mtspr M C S R ,r0 / * m a c h i n e c h e c k s y n d r o m e r e g i s t e r * /
mtxer r0 / * c l e a r i n t e g e r e x c e p t i o n r e g i s t e r * /
lis r1 ,0 x00 0 2 / * s e t C E b i t ( C r i t i c a l E x c e p t i o n s ) * /
ori r1 ,r1 ,0 x12 0 0 / * s e t M E / D E b i t * /
mtmsr r1 / * c h a n g e M S R * /
isync
/* Enable Time Base and Select Time Base Clock */
lis r0 ,H I D 0 _ E M C P @h /* Enable machine check */
# if d e f i n e d ( C O N F I G _ E N A B L E _ 3 6 B I T _ P H Y S )
ori r0 ,r0 ,( H I D 0 _ T B E N | H I D 0 _ E N M A S 7 ) @l /* Enable Timebase & MAS7 */
# else
ori r0 ,r0 ,H I D 0 _ T B E N @l /* enable Timebase */
ori r0 ,r0 ,H I D 0 _ E N M A S 7 @l /* Enable MAS7 */
# endif
ori r0 ,r0 ,H I D 0 _ T B E N @l /* Enable Timebase */
mtspr H I D 0 ,r0
li r0 ,( H I D 1 _ A S T M E | H I D 1 _ A B E ) @l /* Addr streaming & broadcast */
@ -246,6 +181,58 @@ _start_e500:
mtspr D B C R 0 ,r0
# endif
/* create a temp mapping in AS=1 to the boot window */
lis r6 ,F S L _ B O O K E _ M A S 0 ( 1 , 1 5 , 0 ) @h
ori r6 ,r6 ,F S L _ B O O K E _ M A S 0 ( 1 , 1 5 , 0 ) @l
lis r7 ,F S L _ B O O K E _ M A S 1 ( 1 , 1 , 0 , 1 , B O O K E _ P A G E S Z _ 1 6 M ) @h
ori r7 ,r7 ,F S L _ B O O K E _ M A S 1 ( 1 , 1 , 0 , 1 , B O O K E _ P A G E S Z _ 1 6 M ) @l
lis r8 ,F S L _ B O O K E _ M A S 2 ( T E X T _ B A S E , ( M A S 2 _ I | M A S 2 _ G ) ) @h
ori r8 ,r8 ,F S L _ B O O K E _ M A S 2 ( T E X T _ B A S E , ( M A S 2 _ I | M A S 2 _ G ) ) @l
lis r9 ,F S L _ B O O K E _ M A S 3 ( 0 x f f80 0 0 0 0 , 0 , ( M A S 3 _ S X | M A S 3 _ S W | M A S 3 _ S R ) ) @h
ori r9 ,r9 ,F S L _ B O O K E _ M A S 3 ( 0 x f f80 0 0 0 0 , 0 , ( M A S 3 _ S X | M A S 3 _ S W | M A S 3 _ S R ) ) @l
mtspr M A S 0 ,r6
mtspr M A S 1 ,r7
mtspr M A S 2 ,r8
mtspr M A S 3 ,r9
isync
msync
tlbwe
/* create a temp mapping in AS=1 to the stack */
lis r6 ,F S L _ B O O K E _ M A S 0 ( 1 , 1 4 , 0 ) @h
ori r6 ,r6 ,F S L _ B O O K E _ M A S 0 ( 1 , 1 4 , 0 ) @l
lis r7 ,F S L _ B O O K E _ M A S 1 ( 1 , 1 , 0 , 1 , B O O K E _ P A G E S Z _ 1 6 K ) @h
ori r7 ,r7 ,F S L _ B O O K E _ M A S 1 ( 1 , 1 , 0 , 1 , B O O K E _ P A G E S Z _ 1 6 K ) @l
lis r8 ,F S L _ B O O K E _ M A S 2 ( C F G _ I N I T _ R A M _ A D D R , 0 ) @h
ori r8 ,r8 ,F S L _ B O O K E _ M A S 2 ( C F G _ I N I T _ R A M _ A D D R , 0 ) @l
lis r9 ,F S L _ B O O K E _ M A S 3 ( C F G _ I N I T _ R A M _ A D D R , 0 , ( M A S 3 _ S X | M A S 3 _ S W | M A S 3 _ S R ) ) @h
ori r9 ,r9 ,F S L _ B O O K E _ M A S 3 ( C F G _ I N I T _ R A M _ A D D R , 0 , ( M A S 3 _ S X | M A S 3 _ S W | M A S 3 _ S R ) ) @l
mtspr M A S 0 ,r6
mtspr M A S 1 ,r7
mtspr M A S 2 ,r8
mtspr M A S 3 ,r9
isync
msync
tlbwe
lis r6 ,M S R _ C E | M S R _ M E | M S R _ D E | M S R _ I S | M S R _ D S @h
ori r6 ,r6 ,M S R _ C E | M S R _ M E | M S R _ D E | M S R _ I S | M S R _ D S @l
lis r7 ,s w i t c h _ a s @h
ori r7 ,r7 ,s w i t c h _ a s @l
mtspr S P R N _ S R R 0 ,r7
mtspr S P R N _ S R R 1 ,r6
rfi
switch_as :
/* L1 DCache is used for initial RAM */
/ * Allocate I n i t i a l R A M i n d a t a c a c h e .
@ -305,6 +292,14 @@ _start_cont:
stw r0 ,+ 1 2 ( r1 ) / * S a v e r e t u r n a d d r ( u n d e r f l o w v e c t ) * /
GET_ G O T
bl c p u _ i n i t _ e a r l y _ f
/* switch back to AS = 0 */
lis r3 ,( M S R _ C E | M S R _ M E | M S R _ D E ) @h
ori r3 ,r3 ,( M S R _ C E | M S R _ M E | M S R _ D E ) @l
mtmsr r3
isync
bl c p u _ i n i t _ f
bl b o a r d _ i n i t _ f
isync