2008-05-20 03:53:02 +04:00
/ *
2005-04-17 02:20:36 +04:00
* tsunami. S : H i g h s p e e d M i c r o S p a r c - I m m u / c a c h e o p e r a t i o n s .
*
* Copyright ( C ) 1 9 9 7 D a v i d S . M i l l e r ( d a v e m @caip.rutgers.edu)
* /
# include < a s m / p t r a c e . h >
2005-09-09 22:35:55 +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 / p s r . h >
# include < a s m / a s i . h >
# include < a s m / p a g e . h >
# include < a s m / p g t s r m m u . h >
.text
.align 4
.globl tsunami_ f l u s h _ c a c h e _ a l l , t s u n a m i _ f l u s h _ c a c h e _ m m
.globl tsunami_ f l u s h _ c a c h e _ r a n g e , t s u n a m i _ f l u s h _ c a c h e _ p a g e
.globl tsunami_ f l u s h _ p a g e _ t o _ r a m , t s u n a m i _ f l u s h _ p a g e _ f o r _ d m a
.globl tsunami_flush_sig_insns
.globl tsunami_ f l u s h _ t l b _ a l l , t s u n a m i _ f l u s h _ t l b _ m m
.globl tsunami_ f l u s h _ t l b _ r a n g e , t s u n a m i _ f l u s h _ t l b _ p a g e
/* Sliiick... */
tsunami_flush_cache_page :
tsunami_flush_cache_range :
ld [ % o 0 + 0 x0 ] , % o 0 / * X X X v m a - > v m _ m m , G R O S S X X X * /
tsunami_flush_cache_mm :
ld [ % o 0 + A O F F _ m m _ c o n t e x t ] , % g 2
cmp % g 2 , - 1
be t s u n a m i _ f l u s h _ c a c h e _ o u t
tsunami_flush_cache_all :
WINDOW_ F L U S H ( % g 4 , % g 5 )
tsunami_flush_page_for_dma :
sta % g 0 , [ % g 0 ] A S I _ M _ I C _ F L C L E A R
sta % g 0 , [ % g 0 ] A S I _ M _ D C _ F L C L E A R
tsunami_flush_cache_out :
tsunami_flush_page_to_ram :
retl
nop
tsunami_flush_sig_insns :
flush % o 1
retl
flush % o 1 + 4
/* More slick stuff... */
tsunami_flush_tlb_range :
ld [ % o 0 + 0 x00 ] , % o 0 / * X X X v m a - > v m _ m m G R O S S X X X * /
tsunami_flush_tlb_mm :
ld [ % o 0 + A O F F _ m m _ c o n t e x t ] , % g 2
cmp % g 2 , - 1
be t s u n a m i _ f l u s h _ t l b _ o u t
tsunami_flush_tlb_all :
mov 0 x40 0 , % o 1
sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P R O B E
nop
nop
nop
nop
nop
tsunami_flush_tlb_out :
retl
nop
/* This one can be done in a fine grained manner... */
tsunami_flush_tlb_page :
ld [ % o 0 + 0 x00 ] , % o 0 / * X X X v m a - > v m _ m m G R O S S X X X * /
mov S R M M U _ C T X _ R E G , % g 1
ld [ % o 0 + A O F F _ m m _ c o n t e x t ] , % o 3
andn % o 1 , ( P A G E _ S I Z E - 1 ) , % o 1
cmp % o 3 , - 1
be t s u n a m i _ f l u s h _ t l b _ p a g e _ o u t
lda [ % g 1 ] A S I _ M _ M M U R E G S , % g 5
sta % o 3 , [ % g 1 ] A S I _ M _ M M U R E G S
sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P R O B E
nop
nop
nop
nop
nop
tsunami_flush_tlb_page_out :
retl
sta % g 5 , [ % g 1 ] A S I _ M _ M M U R E G S
# define M I R R O R _ B L O C K ( d s t , s r c , o f f s e t , t 0 , t 1 , t 2 , t 3 ) \
ldd [ s r c + o f f s e t + 0 x18 ] , t 0 ; \
std t 0 , [ d s t + o f f s e t + 0 x18 ] ; \
ldd [ s r c + o f f s e t + 0 x10 ] , t 2 ; \
std t 2 , [ d s t + o f f s e t + 0 x10 ] ; \
ldd [ s r c + o f f s e t + 0 x08 ] , t 0 ; \
std t 0 , [ d s t + o f f s e t + 0 x08 ] ; \
ldd [ s r c + o f f s e t + 0 x00 ] , t 2 ; \
std t 2 , [ d s t + o f f s e t + 0 x00 ] ;
tsunami_copy_1page :
/* NOTE: This routine has to be shorter than 70insns --jj */
or % g 0 , ( P A G E _ S I Z E > > 8 ) , % g 1
1 :
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x00 , % o 2 , % o 3 , % o 4 , % o 5 )
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x20 , % o 2 , % o 3 , % o 4 , % o 5 )
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x40 , % o 2 , % o 3 , % o 4 , % o 5 )
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x60 , % o 2 , % o 3 , % o 4 , % o 5 )
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x80 , % o 2 , % o 3 , % o 4 , % o 5 )
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x a0 , % o 2 , % o 3 , % o 4 , % o 5 )
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x c0 , % o 2 , % o 3 , % o 4 , % o 5 )
MIRROR_ B L O C K ( % o 0 , % o 1 , 0 x e 0 , % o 2 , % o 3 , % o 4 , % o 5 )
subcc % g 1 , 1 , % g 1
add % o 0 , 0 x10 0 , % o 0
bne 1 b
add % o 1 , 0 x10 0 , % o 1
.globl tsunami_setup_blockops
tsunami_setup_blockops :
sethi % h i ( _ _ c o p y _ 1 p a g e ) , % o 0
or % o 0 , % l o ( _ _ c o p y _ 1 p a g e ) , % o 0
sethi % h i ( t s u n a m i _ c o p y _ 1 p a g e ) , % o 1
or % o 1 , % l o ( t s u n a m i _ c o p y _ 1 p a g e ) , % o 1
sethi % h i ( t s u n a m i _ s e t u p _ b l o c k o p s ) , % o 2
or % o 2 , % l o ( t s u n a m i _ s e t u p _ b l o c k o p s ) , % o 2
ld [ % o 1 ] , % o 4
1 : add % o 1 , 4 , % o 1
st % o 4 , [ % o 0 ]
add % o 0 , 4 , % o 0
cmp % o 1 , % o 2
bne 1 b
ld [ % o 1 ] , % o 4
sta % g 0 , [ % g 0 ] A S I _ M _ I C _ F L C L E A R
sta % g 0 , [ % g 0 ] A S I _ M _ D C _ F L C L E A R
retl
nop