2005-04-16 15:20:36 -07:00
/ *
* linux/ a r c h / a r m / m m / c a c h e - v4 . S
*
* Copyright ( C ) 1 9 9 7 - 2 0 0 2 R u s s e l l k i n g
*
* 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
* it 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 s e v e r s i o n 2 a s
* published 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 .
* /
# include < l i n u x / l i n k a g e . h >
# include < l i n u x / i n i t . h >
2008-08-05 16:14:15 +01:00
# include < m a c h / h a r d w a r e . h >
2005-04-16 15:20:36 -07:00
# include < a s m / p a g e . h >
# include " p r o c - m a c r o s . S "
/ *
* flush_ u s e r _ c a c h e _ a l l ( )
*
* Invalidate a l l c a c h e e n t r i e s i n a p a r t i c u l a r a d d r e s s
* space.
*
* - mm - m m _ s t r u c t d e s c r i b i n g a d d r e s s s p a c e
* /
ENTRY( v4 _ f l u s h _ u s e r _ c a c h e _ a l l )
/* FALLTHROUGH */
/ *
* flush_ k e r n _ c a c h e _ a l l ( )
*
* Clean a n d i n v a l i d a t e t h e e n t i r e c a c h e .
* /
ENTRY( v4 _ f l u s h _ k e r n _ c a c h e _ a l l )
2008-10-16 17:37:24 +01:00
# ifdef C O N F I G _ C P U _ C P 1 5
2005-04-16 15:20:36 -07:00
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c7 , 0 @ flush ID cache
mov p c , l r
2006-09-26 17:36:37 +09:00
# else
/* FALLTHROUGH */
# endif
2005-04-16 15:20:36 -07:00
/ *
* flush_ u s e r _ c a c h e _ r a n g e ( s t a r t , e n d , f l a g s )
*
* Invalidate a r a n g e o f c a c h e e n t r i e s i n t h e s p e c i f i e d
* address s p a c e .
*
* - start - s t a r t a d d r e s s ( m a y n o t b e a l i g n e d )
* - end - e n d a d d r e s s ( e x c l u s i v e , m a y n o t b e a l i g n e d )
* - flags - v m a _ a r e a _ s t r u c t f l a g s d e s c r i b i n g a d d r e s s s p a c e
* /
ENTRY( v4 _ f l u s h _ u s e r _ c a c h e _ r a n g e )
2008-10-16 17:37:24 +01:00
# ifdef C O N F I G _ C P U _ C P 1 5
2005-04-16 15:20:36 -07:00
mov i p , #0
mcreq p15 , 0 , i p , c7 , c7 , 0 @ flush ID cache
mov p c , l r
2006-09-26 17:36:37 +09:00
# else
/* FALLTHROUGH */
# endif
2005-04-16 15:20:36 -07:00
/ *
* coherent_ k e r n _ r a n g e ( s t a r t , e n d )
*
* Ensure c o h e r e n c y b e t w e e n t h e I c a c h e a n d t h e D c a c h e i n t h e
* region d e s c r i b e d b y s t a r t . I f y o u h a v e n o n - s n o o p i n g
* Harvard c a c h e s , y o u n e e d t o i m p l e m e n t t h i s f u n c t i o n .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
ENTRY( v4 _ c o h e r e n t _ k e r n _ r a n g e )
/* FALLTHROUGH */
/ *
* coherent_ u s e r _ r a n g e ( s t a r t , e n d )
*
* Ensure c o h e r e n c y b e t w e e n t h e I c a c h e a n d t h e D c a c h e i n t h e
* region d e s c r i b e d b y s t a r t . I f y o u h a v e n o n - s n o o p i n g
* Harvard c a c h e s , y o u n e e d t o i m p l e m e n t t h i s f u n c t i o n .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
ENTRY( v4 _ c o h e r e n t _ u s e r _ r a n g e )
mov p c , l r
/ *
* flush_ k e r n _ d c a c h e _ p a g e ( v o i d * p a g e )
*
* Ensure n o D c a c h e a l i a s i n g o c c u r s , e i t h e r w i t h i t s e l f o r
* the I c a c h e
*
* - addr - p a g e a l i g n e d a d d r e s s
* /
ENTRY( v4 _ f l u s h _ k e r n _ d c a c h e _ p a g e )
/* FALLTHROUGH */
/ *
* dma_ i n v _ r a n g e ( s t a r t , e n d )
*
* Invalidate ( d i s c a r d ) t h e s p e c i f i e d v i r t u a l a d d r e s s r a n g e .
* May n o t w r i t e b a c k a n y e n t r i e s . I f ' s t a r t ' o r ' e n d '
* are n o t c a c h e l i n e a l i g n e d , t h o s e l i n e s m u s t b e w r i t t e n
* back.
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
ENTRY( v4 _ d m a _ i n v _ r a n g e )
/* FALLTHROUGH */
/ *
* dma_ f l u s h _ r a n g e ( s t a r t , e n d )
*
* Clean a n d i n v a l i d a t e t h e s p e c i f i e d v i r t u a l a d d r e s s r a n g e .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
ENTRY( v4 _ d m a _ f l u s h _ r a n g e )
2008-10-16 17:37:24 +01:00
# ifdef C O N F I G _ C P U _ C P 1 5
2005-04-16 15:20:36 -07:00
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c7 , 0 @ flush ID cache
2006-09-26 17:36:37 +09:00
# endif
2005-04-16 15:20:36 -07:00
/* FALLTHROUGH */
/ *
* dma_ c l e a n _ r a n g e ( s t a r t , e n d )
*
* Clean ( w r i t e b a c k ) t h e s p e c i f i e d v i r t u a l a d d r e s s r a n g e .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
ENTRY( v4 _ d m a _ c l e a n _ r a n g e )
mov p c , l r
_ _ INITDATA
.type v4 _ c a c h e _ f n s , #o b j e c t
ENTRY( v4 _ c a c h e _ f n s )
.long v4_flush_kern_cache_all
.long v4_flush_user_cache_all
.long v4_flush_user_cache_range
.long v4_coherent_kern_range
.long v4_coherent_user_range
.long v4_flush_kern_dcache_page
.long v4_dma_inv_range
.long v4_dma_clean_range
.long v4_dma_flush_range
.size v4 _ c a c h e _ f n s , . - v4 _ c a c h e _ f n s