2011-03-18 16:54:30 +00:00
/ * MN1 0 3 0 0 C P U c a c h e i n v a l i d a t i o n r o u t i n e s , u s i n g a u t o m a t i c p u r g e r e g i s t e r s
*
* Copyright ( C ) 2 0 1 1 R e d H a t , I n c . A l l R i g h t s R e s e r v e d .
* Written b y D a v i d H o w e l l s ( d h o w e l l s @redhat.com)
*
* 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 c e
* as p u b l i s h e d 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 t h e L i c e n c 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 .
* /
# include < l i n u x / s y s . h >
# include < l i n u x / l i n k a g e . h >
# include < a s m / s m p . h >
# include < a s m / p a g e . h >
# include < a s m / c a c h e . h >
# include < a s m / i r q f l a g s . h >
# include < a s m / c a c h e f l u s h . h >
# include " c a c h e . i n c "
.am33_2
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# void d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v ( v o i d )
# Flush t h e e n t i r e d a t a c a c h e b a c k t o R A M a n d i n v a l i d a t e t h e i c a c h e
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
ALIGN
.globl debugger_local_cache_flushinv
.type debugger_ l o c a l _ c a c h e _ f l u s h i n v ,@function
debugger_local_cache_flushinv :
#
# firstly f l u s h t h e d c a c h e
#
movhu ( C H C T R ) ,d0
btst C H C T R _ D C E N | C H C T R _ I C E N ,d0
beq d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ e n d
mov D C P G C R ,a0
mov e p s w ,d1
and ~ E P S W _ I E ,e p s w
or E P S W _ N M I D ,e p s w
nop
btst C H C T R _ D C E N ,d0
beq d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ n o _ d c a c h e
# wait f o r b u s y b i t o f a r e a p u r g e
setlb
mov ( a0 ) ,d0
btst D C P G C R _ D C P G B S Y ,d0
lne
# set m a s k
clr d0
mov d0 ,( D C P G M R )
# area p u r g e
#
# DCPGCR = D C P G C R _ D C P
#
mov D C P G C R _ D C P ,d0
mov d0 ,( a0 )
# wait f o r b u s y b i t o f a r e a p u r g e
setlb
mov ( a0 ) ,d0
btst D C P G C R _ D C P G B S Y ,d0
lne
debugger_local_cache_flushinv_no_dcache :
#
# secondly, i n v a l i d a t e t h e i c a c h e i f i t i s e n a b l e d
#
mov C H C T R ,a0
movhu ( a0 ) ,d0
btst C H C T R _ I C E N ,d0
beq d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ d o n e
invalidate_ i c a c h e 0
debugger_local_cache_flushinv_done :
mov d1 ,e p s w
debugger_local_cache_flushinv_end :
ret [ ] ,0
.size debugger_ l o c a l _ c a c h e _ f l u s h i n v ,. - d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# void d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ o n e ( u 8 * a d d r )
#
# Invalidate o n e p a r t i c u l a r c a c h e l i n e i f i t ' s i n t h e i c a c h e
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
ALIGN
.globl debugger_local_cache_flushinv_one
.type debugger_ l o c a l _ c a c h e _ f l u s h i n v _ o n e ,@function
debugger_local_cache_flushinv_one :
movhu ( C H C T R ) ,d1
btst C H C T R _ D C E N | C H C T R _ I C E N ,d1
beq d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ o n e _ e n d
btst C H C T R _ D C E N ,d1
beq d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ o n e _ n o _ d c a c h e
# round c a c h e l i n e a d d r d o w n
and L 1 _ C A C H E _ T A G _ M A S K ,d0
mov d0 ,a1
mov d0 ,d1
# determine t h e d c a c h e p u r g e c o n t r o l r e g a d d r e s s
mov D C A C H E _ P U R G E ( 0 ,0 ) ,a0
and L 1 _ C A C H E _ T A G _ E N T R Y ,d0
add d0 ,a0
# retain v a l i d e n t r i e s i n t h e c a c h e
or L 1 _ C A C H E _ T A G _ V A L I D ,d1
# conditionally p u r g e t h i s l i n e i n a l l w a y s
mov d1 ,( L 1 _ C A C H E _ W A Y D I S P * 0 ,a0 )
2011-06-06 15:47:05 +01:00
debugger_local_cache_flushinv_one_no_dcache :
2011-03-18 16:54:30 +00:00
#
# now t r y t o f l u s h t h e i c a c h e
#
mov C H C T R ,a0
movhu ( a0 ) ,d0
btst C H C T R _ I C E N ,d0
2011-06-06 15:47:05 +01:00
beq d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ o n e _ e n d
2011-03-18 16:54:30 +00:00
LOCAL_ C L I _ S A V E ( d1 )
mov I C I V C R ,a0
# wait f o r t h e i n v a l i d a t o r t o q u i e s c e
setlb
mov ( a0 ) ,d0
btst I C I V C R _ I C I V B S Y ,d0
lne
# set t h e m a s k
mov L 1 _ C A C H E _ T A G _ M A S K ,d0
mov d0 ,( I C I V M R )
# invalidate t h e c a c h e l i n e a t t h e g i v e n a d d r e s s
or I C I V C R _ I C I ,a1
mov a1 ,( a0 )
# wait f o r t h e i n v a l i d a t o r t o q u i e s c e a g a i n
setlb
mov ( a0 ) ,d0
btst I C I V C R _ I C I V B S Y ,d0
lne
LOCAL_ I R Q _ R E S T O R E ( d1 )
debugger_local_cache_flushinv_one_end :
ret [ ] ,0
.size debugger_ l o c a l _ c a c h e _ f l u s h i n v _ o n e ,. - d e b u g g e r _ l o c a l _ c a c h e _ f l u s h i n v _ o n e