2008-05-19 16:53:02 -07:00
/ *
2005-04-16 15:20:36 -07:00
* swift. S : M i c r o S p a r c - I I m m u / c a c h e o p e r a t i o n s .
*
* Copyright ( C ) 1 9 9 9 D a v i d S . M i l l e r ( d a v e m @redhat.com)
* /
# 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 >
2005-09-09 20:35:55 +02:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-16 15:20:36 -07:00
.text
.align 4
# if 1 / * X X X s c r e w t h i s , I c a n ' t g e t t h e V A C f l u s h e s w o r k i n g
* XXX r e l i a b l y . . . - D a v e M
* /
.globl swift_ f l u s h _ c a c h e _ a l l , s w i f t _ f l u s h _ c a c h e _ m m
.globl swift_ f l u s h _ c a c h e _ r a n g e , s w i f t _ f l u s h _ c a c h e _ p a g e
.globl swift_flush_page_for_dma
.globl swift_flush_page_to_ram
swift_flush_cache_all :
swift_flush_cache_mm :
swift_flush_cache_range :
swift_flush_cache_page :
swift_flush_page_for_dma :
swift_flush_page_to_ram :
sethi % h i ( 0 x20 0 0 ) , % o 0
1 : subcc % o 0 , 0 x10 , % o 0
add % o 0 , % o 0 , % o 1
sta % g 0 , [ % o 0 ] A S I _ M _ D A T A C _ T A G
bne 1 b
sta % g 0 , [ % o 1 ] A S I _ M _ T X T C _ T A G
retl
nop
# else
.globl swift_flush_cache_all
swift_flush_cache_all :
WINDOW_ F L U S H ( % g 4 , % g 5 )
/* Just clear out all the tags. */
sethi % h i ( 1 6 * 1 0 2 4 ) , % o 0
1 : subcc % o 0 , 1 6 , % o 0
sta % g 0 , [ % o 0 ] A S I _ M _ T X T C _ T A G
bne 1 b
sta % g 0 , [ % o 0 ] A S I _ M _ D A T A C _ T A G
retl
nop
.globl swift_flush_cache_mm
swift_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 s w i f t _ f l u s h _ c a c h e _ m m _ o u t
WINDOW_ F L U S H ( % g 4 , % g 5 )
rd % p s r , % g 1
andn % g 1 , P S R _ E T , % g 3
wr % g 3 , 0 x0 , % p s r
nop
nop
mov S R M M U _ C T X _ R E G , % g 7
lda [ % g 7 ] A S I _ M _ M M U R E G S , % g 5
sta % g 2 , [ % g 7 ] A S I _ M _ M M U R E G S
# if 1
sethi % h i ( 0 x20 0 0 ) , % o 0
1 : subcc % o 0 , 0 x10 , % o 0
sta % g 0 , [ % o 0 ] A S I _ M _ F L U S H _ C T X
bne 1 b
nop
# else
clr % o 0
or % g 0 , 2 0 4 8 , % g 7
or % g 0 , 2 0 4 8 , % o 1
add % o 1 , 2 0 4 8 , % o 2
add % o 2 , 2 0 4 8 , % o 3
mov 1 6 , % o 4
add % o 4 , 2 0 4 8 , % o 5
add % o 5 , 2 0 4 8 , % g 2
add % g 2 , 2 0 4 8 , % g 3
1 : sta % g 0 , [ % o 0 ] A S I _ M _ F L U S H _ C T X
sta % g 0 , [ % o 0 + % o 1 ] A S I _ M _ F L U S H _ C T X
sta % g 0 , [ % o 0 + % o 2 ] A S I _ M _ F L U S H _ C T X
sta % g 0 , [ % o 0 + % o 3 ] A S I _ M _ F L U S H _ C T X
sta % g 0 , [ % o 0 + % o 4 ] A S I _ M _ F L U S H _ C T X
sta % g 0 , [ % o 0 + % o 5 ] A S I _ M _ F L U S H _ C T X
sta % g 0 , [ % o 0 + % g 2 ] A S I _ M _ F L U S H _ C T X
sta % g 0 , [ % o 0 + % g 3 ] A S I _ M _ F L U S H _ C T X
subcc % g 7 , 3 2 , % g 7
bne 1 b
add % o 0 , 3 2 , % o 0
# endif
mov S R M M U _ C T X _ R E G , % g 7
sta % g 5 , [ % g 7 ] A S I _ M _ M M U R E G S
wr % g 1 , 0 x0 , % p s r
nop
nop
swift_flush_cache_mm_out :
retl
nop
.globl swift_flush_cache_range
swift_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 * /
sub % o 2 , % o 1 , % o 2
sethi % h i ( 4 0 9 6 ) , % o 3
cmp % o 2 , % o 3
bgu s w i f t _ f l u s h _ c a c h e _ m m
nop
b 7 0 f
nop
.globl swift_flush_cache_page
swift_flush_cache_page :
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 * /
70 :
ld [ % o 0 + A O F F _ m m _ c o n t e x t ] , % g 2
cmp % g 2 , - 1
be s w i f t _ f l u s h _ c a c h e _ p a g e _ o u t
WINDOW_ F L U S H ( % g 4 , % g 5 )
rd % p s r , % g 1
andn % g 1 , P S R _ E T , % g 3
wr % g 3 , 0 x0 , % p s r
nop
nop
mov S R M M U _ C T X _ R E G , % g 7
lda [ % g 7 ] A S I _ M _ M M U R E G S , % g 5
sta % g 2 , [ % g 7 ] A S I _ M _ M M U R E G S
andn % o 1 , ( P A G E _ S I Z E - 1 ) , % o 1
# if 1
sethi % h i ( 0 x10 0 0 ) , % o 0
1 : subcc % o 0 , 0 x10 , % o 0
sta % g 0 , [ % o 1 + % o 0 ] A S I _ M _ F L U S H _ P A G E
bne 1 b
nop
# else
or % g 0 , 5 1 2 , % g 7
or % g 0 , 5 1 2 , % o 0
add % o 0 , 5 1 2 , % o 2
add % o 2 , 5 1 2 , % o 3
add % o 3 , 5 1 2 , % o 4
add % o 4 , 5 1 2 , % o 5
add % o 5 , 5 1 2 , % g 3
add % g 3 , 5 1 2 , % g 4
1 : sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 0 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 2 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 3 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 4 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 5 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % g 3 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % g 4 ] A S I _ M _ F L U S H _ P A G E
subcc % g 7 , 1 6 , % g 7
bne 1 b
add % o 1 , 1 6 , % o 1
# endif
mov S R M M U _ C T X _ R E G , % g 7
sta % g 5 , [ % g 7 ] A S I _ M _ M M U R E G S
wr % g 1 , 0 x0 , % p s r
nop
nop
swift_flush_cache_page_out :
retl
nop
/ * Swift i s w r i t e - t h r u , h o w e v e r i t i s n o t
* I/ O n o r T L B - w a l k c o h e r e n t . A l s o i t h a s
* caches w h i c h a r e v i r t u a l l y i n d e x e d a n d t a g g e d .
* /
.globl swift_flush_page_for_dma
.globl swift_flush_page_to_ram
swift_flush_page_for_dma :
swift_flush_page_to_ram :
andn % o 0 , ( P A G E _ S I Z E - 1 ) , % o 1
# if 1
sethi % h i ( 0 x10 0 0 ) , % o 0
1 : subcc % o 0 , 0 x10 , % o 0
sta % g 0 , [ % o 1 + % o 0 ] A S I _ M _ F L U S H _ P A G E
bne 1 b
nop
# else
or % g 0 , 5 1 2 , % g 7
or % g 0 , 5 1 2 , % o 0
add % o 0 , 5 1 2 , % o 2
add % o 2 , 5 1 2 , % o 3
add % o 3 , 5 1 2 , % o 4
add % o 4 , 5 1 2 , % o 5
add % o 5 , 5 1 2 , % g 3
add % g 3 , 5 1 2 , % g 4
1 : sta % g 0 , [ % o 1 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 0 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 2 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 3 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 4 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % o 5 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % g 3 ] A S I _ M _ F L U S H _ P A G E
sta % g 0 , [ % o 1 + % g 4 ] A S I _ M _ F L U S H _ P A G E
subcc % g 7 , 1 6 , % g 7
bne 1 b
add % o 1 , 1 6 , % o 1
# endif
retl
nop
# endif
.globl swift_flush_sig_insns
swift_flush_sig_insns :
flush % o 1
retl
flush % o 1 + 4
.globl swift_flush_tlb_mm
.globl swift_flush_tlb_range
.globl swift_flush_tlb_all
swift_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 * /
swift_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 s w i f t _ f l u s h _ t l b _ a l l _ o u t
swift_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
swift_flush_tlb_all_out :
retl
nop
.globl swift_flush_tlb_page
swift_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 s w i f t _ f l u s h _ t l b _ p a g e _ o u t
nop
# if 1
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
# else
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 A G E / * r e m . v i r t . c a c h e . p r o t . * /
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
# endif
swift_flush_tlb_page_out :
retl
nop