@ -1,74 +1,31 @@
/ *
*
* See f i l e C R E D I T S f o r l i s t o f p e o p l e w h o c o n t r i b u t e d t o t h i s
* project.
*
* 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 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 ; either version 2 of
* the 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 .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y 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
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e , S u i t e 3 3 0 , B o s t o n ,
* MA 0 2 1 1 1 - 1 3 0 7 U S A
* /
* ( C) C o p y r i g h t 2 0 0 7
* Stefan R o e s e , D E N X S o f t w a r e E n g i n e e r i n g , s r @denx.de.
*
* Copyright ( C ) 2 0 0 2 S c o t t M c N u t t < s m c n u t t @artesyncp.com>
*
* See f i l e C R E D I T S f o r l i s t o f p e o p l e w h o c o n t r i b u t e d t o t h i s
* project.
*
* 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 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 ; either version 2 of
* the 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 .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y 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
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e , S u i t e 3 3 0 , B o s t o n ,
* MA 0 2 1 1 1 - 1 3 0 7 U S A
* /
# include < p p c _ a s m . t m p l >
# include < c o n f i g . h >
/* General */
# define T L B _ V A L I D 0 x00 0 0 0 2 0 0
/* Supported page sizes */
# define S Z _ 1 K 0 x00 0 0 0 0 0 0
# define S Z _ 4 K 0 x00 0 0 0 0 1 0
# define S Z _ 1 6 K 0 x00 0 0 0 0 2 0
# define S Z _ 6 4 K 0 x00 0 0 0 0 3 0
# define S Z _ 2 5 6 K 0 x00 0 0 0 0 4 0
# define S Z _ 1 M 0 x00 0 0 0 0 5 0
# define S Z _ 8 M 0 x00 0 0 0 0 6 0
# define S Z _ 1 6 M 0 x00 0 0 0 0 7 0
# define S Z _ 2 5 6 M 0 x00 0 0 0 0 9 0
/* Storage attributes */
# define S A _ W 0 x00 0 0 0 8 0 0 / * W r i t e - t h r o u g h * /
# define S A _ I 0 x00 0 0 0 4 0 0 / * C a c h i n g i n h i b i t e d * /
# define S A _ M 0 x00 0 0 0 2 0 0 / * M e m o r y c o h e r e n c e * /
# define S A _ G 0 x00 0 0 0 1 0 0 / * G u a r d e d * /
# define S A _ E 0 x00 0 0 0 0 8 0 / * E n d i a n * /
/* Access control */
# define A C _ X 0 x00 0 0 0 0 2 4 / * E x e c u t e * /
# define A C _ W 0 x00 0 0 0 0 1 2 / * W r i t e * /
# define A C _ R 0 x00 0 0 0 0 0 9 / * R e a d * /
/* Some handy macros */
# define E P N ( e ) ( ( e ) & 0 x f f f f f c00 )
# define T L B 0 ( e p n ,s z ) ( ( E P N ( ( e p n ) ) | ( s z ) | T L B _ V A L I D ) )
# define T L B 1 ( r p n ,e r p n ) ( ( ( r p n ) & 0 x f f f f f c00 ) | ( e r p n ) )
# define T L B 2 ( a ) ( ( a ) & 0 x00 0 0 0 f b f )
# define t l b t a b _ s t a r t \
mflr r1 ;\
bl 0 f ;
# define t l b t a b _ e n d \
.long 0 , 0 , 0 ; \
0 : mflr r0 ; \
mtlr r1 ; \
blr ;
# define t l b e n t r y ( e p n ,s z ,r p n ,e r p n ,a t t r ) \
.long TLB0 ( e p n ,s z ) ,T L B 1 ( r p n ,e r p n ) ,T L B 2 ( a t t r )
# include < a s m - p p c / m m u . h >
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* TLB T A B L E
@ -80,34 +37,68 @@
* Pointer t o t h e t a b l e i s r e t u r n e d i n r1
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
.section .bootpg , " ax"
.globl tlbtab
.section .bootpg , " ax"
.globl tlbtab
tlbtab :
tlbtab_ s t a r t
/ *
* BOOT_ C S ( F L A S H ) m u s t b e f i r s t . B e f o r e r e l o c a t i o n S A _ I c a n b e o f f t o u s e t h e
* speed u p b o o t p r o c e s s . I t i s p a t c h e d a f t e r r e l o c a t i o n t o e n a b l e S A _ I
* /
tlbentry( C F G _ B O O T _ B A S E _ A D D R , S Z _ 2 5 6 M , C F G _ B O O T _ B A S E _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ G / * | S A _ I * / )
/* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
tlbentry( C F G _ I N I T _ R A M _ A D D R , S Z _ 6 4 K , C F G _ I N I T _ R A M _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ G )
tlbentry( C F G _ S D R A M _ B A S E , S Z _ 2 5 6 M , C F G _ S D R A M _ B A S E , 0 , A C _ R | A C _ W | A C _ X | S A _ G | S A _ I )
tlbentry( C F G _ P C I _ B A S E , S Z _ 2 5 6 M , C F G _ P C I _ B A S E , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ N V R A M _ B A S E _ A D D R , S Z _ 2 5 6 M , C F G _ N V R A M _ B A S E _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ W | S A _ I )
tlbentry( C F G _ N A N D _ A D D R , S Z _ 2 5 6 M , C F G _ N A N D _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ W | S A _ I )
/* PCI */
tlbentry( C F G _ P C I _ M E M B A S E , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ P C I _ M E M B A S E 1 , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E 1 , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ P C I _ M E M B A S E 2 , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E 2 , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ P C I _ M E M B A S E 3 , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E 3 , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
/* USB 2.0 Device */
tlbentry( C F G _ U S B _ D E V I C E , S Z _ 1 K , C F G _ U S B _ D E V I C E , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbtab_ e n d
tlbtab_ s t a r t
/ *
* BOOT_ C S ( F L A S H ) m u s t b e f i r s t . B e f o r e r e l o c a t i o n S A _ I c a n b e o f f t o u s e t h e
* speed u p b o o t p r o c e s s . I t i s p a t c h e d a f t e r r e l o c a t i o n t o e n a b l e S A _ I
* /
# ifndef C O N F I G _ N A N D _ S P L
tlbentry( C F G _ B O O T _ B A S E _ A D D R , S Z _ 2 5 6 M , C F G _ B O O T _ B A S E _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ G )
# else
tlbentry( C F G _ N A N D _ B O O T _ S P L _ S R C , S Z _ 4 K , C F G _ N A N D _ B O O T _ S P L _ S R C , 0 , A C _ R | A C _ W | A C _ X | S A _ G )
# endif
/* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
tlbentry( C F G _ I N I T _ R A M _ A D D R , S Z _ 4 K , C F G _ I N I T _ R A M _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ G )
tlbentry( C F G _ S D R A M _ B A S E , S Z _ 2 5 6 M , C F G _ S D R A M _ B A S E , 0 , A C _ R | A C _ W | A C _ X | S A _ G | S A _ I )
/* PCI base & peripherals */
tlbentry( C F G _ P C I _ B A S E , S Z _ 2 5 6 M , C F G _ P C I _ B A S E , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ N V R A M _ B A S E _ A D D R , S Z _ 2 5 6 M , C F G _ N V R A M _ B A S E _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ W | S A _ I )
tlbentry( C F G _ N A N D _ A D D R , S Z _ 4 K , C F G _ N A N D _ A D D R , 0 , A C _ R | A C _ W | A C _ X | S A _ W | S A _ I )
/* PCI */
tlbentry( C F G _ P C I _ M E M B A S E , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ P C I _ M E M B A S E 1 , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E 1 , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ P C I _ M E M B A S E 2 , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E 2 , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbentry( C F G _ P C I _ M E M B A S E 3 , S Z _ 2 5 6 M , C F G _ P C I _ M E M B A S E 3 , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
/* USB 2.0 Device */
tlbentry( C F G _ U S B _ D E V I C E , S Z _ 1 K , C F G _ U S B _ D E V I C E , 0 , A C _ R | A C _ W | S A _ G | S A _ I )
tlbtab_ e n d
# if d e f i n e d ( C O N F I G _ N A N D _ U _ B O O T ) & & ! d e f i n e d ( C O N F I G _ N A N D _ S P L )
/ *
* For N A N D b o o t i n g t h e f i r s t T L B h a s t o b e r e c o n f i g u r e d t o f u l l s i z e
* and w i t h c a c h i n g d i s a b l e d a f t e r r u n n i n g f r o m R A M !
* /
# define T L B 0 0 T L B 0 ( C F G _ B O O T _ B A S E _ A D D R , S Z _ 2 5 6 M )
# define T L B 0 1 T L B 1 ( C F G _ B O O T _ B A S E _ A D D R , 0 )
# define T L B 0 2 T L B 2 ( A C _ R | A C _ W | A C _ X | S A _ G | S A _ I )
.globl reconfig_tlb0
reconfig_tlb0 :
sync
isync
addi r4 ,r0 ,0 x00 0 0 / * T L B e n t r y #0 * /
lis r5 ,T L B 0 0 @h
ori r5 ,r5 ,T L B 0 0 @l
tlbwe r5 ,r4 ,0 x00 0 0 / * S a v e i t o u t * /
lis r5 ,T L B 0 1 @h
ori r5 ,r5 ,T L B 0 1 @l
tlbwe r5 ,r4 ,0 x00 0 1 / * S a v e i t o u t * /
lis r5 ,T L B 0 2 @h
ori r5 ,r5 ,T L B 0 2 @l
tlbwe r5 ,r4 ,0 x00 0 2 / * S a v e i t o u t * /
sync
isync
blr
# endif