@ -34,24 +34,16 @@
# define S T A T U S _ S E T S T 0 _ K X
# endif
/ *
* For t h e m o m e n t d i s a b l e i n t e r r u p t s , m a r k t h e k e r n e l m o d e a n d
* set S T 0 _ K X s o t h a t t h e C P U d o e s n o t s p i t f i r e w h e n u s i n g
* 6 4 - bit a d d r e s s e s .
* /
.macro setup_c0_status set c l r
.set push
mfc0 t 0 , C P 0 _ S T A T U S
or t 0 , S T 0 _ C U 0 | \ s e t | 0 x1 f | \ c l r
xor t 0 , 0 x1 f | \ c l r
mtc0 t 0 , C P 0 _ S T A T U S
.set noreorder
sll z e r o , 3 # e h b
.set pop
.endm
.set noreorder
.macro init_wr sel
MTC0 z e r o , C P 0 _ W A T C H L O ,\ s e l
mtc0 t 1 , C P 0 _ W A T C H H I ,\ s e l
mfc0 t 0 , C P 0 _ W A T C H H I ,\ s e l
bgez t 0 , w r _ d o n e
nop
.endm
.macro uhi_mips_exception
move k 0 , t 9 # p r e s e r v e t 9 i n k 0
move k 1 , a0 # p r e s e r v e a 0 i n k 1
@ -63,7 +55,7 @@
ENTRY( _ s t a r t )
/* U-Boot entry point */
b r e s e t
n op
mtc0 z e r o , C P 0 _ C O U N T # c l e a r c p 0 c o u n t f o r m o s t a c c u r a t e b o o t t i m i n g
# if d e f i n e d ( C O N F I G _ S Y S _ X W A Y _ E B U _ B O O T C F G )
/ *
@ -141,17 +133,51 @@ reset:
b 3 b
nop
/* Clear watch registers */
4 : MTC0 z e r o , C P 0 _ W A T C H L O
/* Init CP0 Status */
4 : mfc0 t 0 , C P 0 _ S T A T U S
and t 0 , S T 0 _ I M P L
or t 0 , S T 0 _ B E V | S T 0 _ E R L | S T A T U S _ S E T
mtc0 t 0 , C P 0 _ S T A T U S
/ *
* Check w h e t h e r C P 0 C o n f i g 1 i s i m p l e m e n t e d . I f n o t c o n t i n u e
* with l e g a c y W a t c h r e g i s t e r i n i t i a l i z a t i o n .
* /
mfc0 t 0 , C P 0 _ C O N F I G
bgez t 0 , w r _ l e g a c y
nop
/ *
* Check W R b i t i n C P 0 C o n f i g 1 t o d e t e r m i n e i f W a t c h r e g i s t e r s
* are i m p l e m e n t e d .
* /
mfc0 t 0 , C P 0 _ C O N F I G , 1
andi t 0 , ( 1 < < 3 )
beqz t 0 , w r _ d o n e
nop
/* Clear Watch Status bits and disable watch exceptions */
li t 1 , 0 x7 # C l e a r I , R a n d W c o n d i t i o n s
init_ w r 0
init_ w r 1
init_ w r 2
init_ w r 3
init_ w r 4
init_ w r 5
init_ w r 6
init_ w r 7
b w r _ d o n e
nop
wr_legacy :
MTC0 z e r o , C P 0 _ W A T C H L O
mtc0 z e r o , C P 0 _ W A T C H H I
/* WP(Watch Pending), SW0/1 should be cleared */
wr_done :
/* Clear WP, IV and SW interrupts */
mtc0 z e r o , C P 0 _ C A U S E
setup_ c0 _ s t a t u s S T A T U S _ S E T 0
/* Init Timer */
mtc0 z e r o , C P 0 _ C O U N T
/* Clear timer interrupt (CP0_COUNT cleared on branch to 'reset') */
mtc0 z e r o , C P 0 _ C O M P A R E
# ifndef C O N F I G _ S K I P _ L O W L E V E L _ I N I T