2008-05-20 03:53:02 +04:00
/ *
2005-04-17 02:20:36 +04:00
* viking. S : H i g h s p e e d V i k i n g c a c h e / m m u o p e r a t i o n s
*
* Copyright ( C ) 1 9 9 7 E d d i e C . D o s t ( e c d @skynet.be)
* Copyright ( C ) 1 9 9 7 ,1 9 9 8 ,1 9 9 9 J a k u b J e l i n e k ( j j @ultra.linux.cz)
* Copyright ( C ) 1 9 9 9 P a v e l S e m e r a d ( s e m e r a d @ss1000.ms.mff.cuni.cz)
* /
# include < a s m / p t r a c e . h >
# include < a s m / p s r . 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 / a s i . h >
# include < a s m / m x c c . h >
# include < a s m / p a g e . h >
# include < a s m / p g t s r m m u . h >
# include < a s m / v i k i n g . h >
# ifdef C O N F I G _ S M P
.data
.align 4
sun4dsmp_flush_tlb_spin :
.word 0
# endif
.text
.align 4
.globl viking_ f l u s h _ c a c h e _ a l l , v i k i n g _ f l u s h _ c a c h e _ m m
.globl viking_ f l u s h _ c a c h e _ r a n g e , v i k i n g _ f l u s h _ c a c h e _ p a g e
.globl viking_ f l u s h _ p a g e , v i k i n g _ m x c c _ f l u s h _ p a g e
.globl viking_ f l u s h _ p a g e _ f o r _ d m a , v i k i n g _ f l u s h _ p a g e _ t o _ r a m
.globl viking_flush_sig_insns
.globl viking_ f l u s h _ t l b _ a l l , v i k i n g _ f l u s h _ t l b _ m m
.globl viking_ f l u s h _ t l b _ r a n g e , v i k i n g _ f l u s h _ t l b _ p a g e
viking_flush_page :
sethi % h i ( P A G E _ O F F S E T ) , % g 2
sub % o 0 , % g 2 , % g 3
srl % g 3 , 1 2 , % g 1 ! p p a g e > > 1 2
clr % o 1 ! s e t c o u n t e r , 0 - 1 2 7
sethi % h i ( P A G E _ O F F S E T + P A G E _ S I Z E - 0 x80 0 0 0 0 0 0 ) , % o 3
sethi % h i ( 0 x80 0 0 0 0 0 0 ) , % o 4
sethi % h i ( V I K I N G _ P T A G _ V A L I D ) , % o 5
sethi % h i ( 2 * P A G E _ S I Z E ) , % o 0
sethi % h i ( P A G E _ S I Z E ) , % g 7
clr % o 2 ! b l o c k c o u n t e r , 0 - 3
5 :
sll % o 1 , 5 , % g 4
or % g 4 , % o 4 , % g 4 ! 0 x80 0 0 0 0 0 0 | ( s e t < < 5 )
sll % o 2 , 2 6 , % g 5 ! b l o c k < < 2 6
6 :
or % g 5 , % g 4 , % g 5
ldda [ % g 5 ] A S I _ M _ D A T A C _ T A G , % g 2
cmp % g 3 , % g 1 ! p t a g = = p p a g e ?
bne 7 f
inc % o 2
andcc % g 2 , % o 5 , % g 0 ! p t a g V A L I D ?
be 7 f
add % g 4 , % o 3 , % g 2 ! ( P A G E _ O F F S E T + P A G E _ S I Z E ) | ( s e t < < 5 )
ld [ % g 2 ] , % g 3
ld [ % g 2 + % g 7 ] , % g 3
add % g 2 , % o 0 , % g 2
ld [ % g 2 ] , % g 3
ld [ % g 2 + % g 7 ] , % g 3
add % g 2 , % o 0 , % g 2
ld [ % g 2 ] , % g 3
ld [ % g 2 + % g 7 ] , % g 3
add % g 2 , % o 0 , % g 2
ld [ % g 2 ] , % g 3
b 8 f
ld [ % g 2 + % g 7 ] , % g 3
7 :
cmp % o 2 , 3
ble 6 b
sll % o 2 , 2 6 , % g 5 ! b l o c k < < 2 6
8 : inc % o 1
cmp % o 1 , 0 x7 f
ble 5 b
clr % o 2
9 : retl
nop
viking_mxcc_flush_page :
sethi % h i ( P A G E _ O F F S E T ) , % g 2
sub % o 0 , % g 2 , % g 3
sub % g 3 , - P A G E _ S I Z E , % g 3 ! p p a g e + P A G E _ S I Z E
sethi % h i ( M X C C _ S R C S T R E A M ) , % o 3 ! a s s u m e % h i ( M X C C _ S R C S T R E A M ) = = % h i ( M X C C _ D E S T S T R E A M )
mov 0 x10 , % g 2 ! s e t c a c h e a b l e b i t
or % o 3 , % l o ( M X C C _ S R C S T R E A M ) , % o 2
or % o 3 , % l o ( M X C C _ D E S S T R E A M ) , % o 3
sub % g 3 , M X C C _ S T R E A M _ S I Z E , % g 3
6 :
stda % g 2 , [ % o 2 ] A S I _ M _ M X C C
stda % g 2 , [ % o 3 ] A S I _ M _ M X C C
andncc % g 3 , P A G E _ M A S K , % g 0
bne 6 b
sub % g 3 , M X C C _ S T R E A M _ S I Z E , % g 3
9 : retl
nop
viking_flush_cache_page :
viking_flush_cache_range :
# ifndef C O N F I G _ S M P
2013-07-11 00:56:10 +04:00
ld [ % o 0 + V M A _ V M _ M M ] , % o 0
2005-04-17 02:20:36 +04:00
# endif
viking_flush_cache_mm :
# ifndef C O N F I G _ S M P
ld [ % o 0 + A O F F _ m m _ c o n t e x t ] , % g 1
cmp % g 1 , - 1
bne v i k i n g _ f l u s h _ c a c h e _ a l l
nop
b,a v i k i n g _ f l u s h _ c a c h e _ o u t
# endif
viking_flush_cache_all :
WINDOW_ F L U S H ( % g 4 , % g 5 )
viking_flush_cache_out :
retl
nop
viking_flush_tlb_all :
mov 0 x40 0 , % g 1
retl
sta % g 0 , [ % g 1 ] A S I _ M _ F L U S H _ P R O B E
viking_flush_tlb_mm :
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 1
lda [ % g 1 ] A S I _ M _ M M U R E G S , % g 5
# ifndef C O N F I G _ S M P
cmp % o 1 , - 1
be 1 f
# endif
mov 0 x30 0 , % g 2
sta % o 1 , [ % g 1 ] A S I _ M _ M M U R E G S
sta % g 0 , [ % g 2 ] A S I _ M _ F L U S H _ P R O B E
retl
sta % g 5 , [ % g 1 ] A S I _ M _ M M U R E G S
# ifndef C O N F I G _ S M P
1 : retl
nop
# endif
viking_flush_tlb_range :
2013-07-11 00:56:10 +04:00
ld [ % o 0 + V M A _ V M _ M M ] , % o 0
2005-04-17 02:20:36 +04:00
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
lda [ % g 1 ] A S I _ M _ M M U R E G S , % g 5
# ifndef C O N F I G _ S M P
cmp % o 3 , - 1
be 2 f
# endif
sethi % h i ( ~ ( ( 1 < < S R M M U _ P G D I R _ S H I F T ) - 1 ) ) , % o 4
sta % o 3 , [ % g 1 ] A S I _ M _ M M U R E G S
and % o 1 , % o 4 , % o 1
add % o 1 , 0 x20 0 , % o 1
sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P R O B E
1 : sub % o 1 , % o 4 , % o 1
cmp % o 1 , % o 2
blu,a 1 b
sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P R O B E
retl
sta % g 5 , [ % g 1 ] A S I _ M _ M M U R E G S
# ifndef C O N F I G _ S M P
2 : retl
nop
# endif
viking_flush_tlb_page :
2013-07-11 00:56:10 +04:00
ld [ % o 0 + V M A _ V M _ M M ] , % o 0
2005-04-17 02:20:36 +04:00
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
lda [ % g 1 ] A S I _ M _ M M U R E G S , % g 5
# ifndef C O N F I G _ S M P
cmp % o 3 , - 1
be 1 f
# endif
and % o 1 , P A G E _ M A S K , % o 1
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
retl
sta % g 5 , [ % g 1 ] A S I _ M _ M M U R E G S
# ifndef C O N F I G _ S M P
1 : retl
nop
# endif
viking_flush_page_to_ram :
viking_flush_page_for_dma :
viking_flush_sig_insns :
retl
nop
# ifdef C O N F I G _ S M P
.globl sun4 d s m p _ f l u s h _ t l b _ a l l , s u n 4 d s m p _ f l u s h _ t l b _ m m
.globl sun4 d s m p _ f l u s h _ t l b _ r a n g e , s u n 4 d s m p _ f l u s h _ t l b _ p a g e
sun4dsmp_flush_tlb_all :
sethi % h i ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) , % g 3
1 : ldstub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
tst % g 5
bne 2 f
mov 0 x40 0 , % g 1
sta % g 0 , [ % g 1 ] A S I _ M _ F L U S H _ P R O B E
retl
stb % g 0 , [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ]
2 : tst % g 5
bne,a 2 b
ldub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
b,a 1 b
sun4dsmp_flush_tlb_mm :
sethi % h i ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) , % g 3
1 : ldstub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
tst % g 5
bne 2 f
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 1
lda [ % g 1 ] A S I _ M _ M M U R E G S , % g 5
mov 0 x30 0 , % g 2
sta % o 1 , [ % g 1 ] A S I _ M _ M M U R E G S
sta % g 0 , [ % g 2 ] A S I _ M _ F L U S H _ P R O B E
sta % g 5 , [ % g 1 ] A S I _ M _ M M U R E G S
retl
stb % g 0 , [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ]
2 : tst % g 5
bne,a 2 b
ldub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
b,a 1 b
sun4dsmp_flush_tlb_range :
sethi % h i ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) , % g 3
1 : ldstub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
tst % g 5
bne 3 f
mov S R M M U _ C T X _ R E G , % g 1
2013-07-11 00:56:10 +04:00
ld [ % o 0 + V M A _ V M _ M M ] , % o 0
2005-04-17 02:20:36 +04:00
ld [ % o 0 + A O F F _ m m _ c o n t e x t ] , % o 3
lda [ % g 1 ] A S I _ M _ M M U R E G S , % g 5
sethi % h i ( ~ ( ( 1 < < S R M M U _ P G D I R _ S H I F T ) - 1 ) ) , % o 4
sta % o 3 , [ % g 1 ] A S I _ M _ M M U R E G S
and % o 1 , % o 4 , % o 1
add % o 1 , 0 x20 0 , % o 1
sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P R O B E
2 : sub % o 1 , % o 4 , % o 1
cmp % o 1 , % o 2
blu,a 2 b
sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P R O B E
sta % g 5 , [ % g 1 ] A S I _ M _ M M U R E G S
retl
stb % g 0 , [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ]
3 : tst % g 5
bne,a 3 b
ldub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
b,a 1 b
sun4dsmp_flush_tlb_page :
sethi % h i ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) , % g 3
1 : ldstub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
tst % g 5
bne 2 f
mov S R M M U _ C T X _ R E G , % g 1
2013-07-11 00:56:10 +04:00
ld [ % o 0 + V M A _ V M _ M M ] , % o 0
2005-04-17 02:20:36 +04:00
ld [ % o 0 + A O F F _ m m _ c o n t e x t ] , % o 3
lda [ % g 1 ] A S I _ M _ M M U R E G S , % g 5
and % o 1 , P A G E _ M A S K , % o 1
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
sta % g 5 , [ % g 1 ] A S I _ M _ M M U R E G S
retl
stb % g 0 , [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ]
2 : tst % g 5
bne,a 2 b
ldub [ % g 3 + % l o ( s u n 4 d s m p _ f l u s h _ t l b _ s p i n ) ] , % g 5
b,a 1 b
nop
# endif