2005-04-17 02:20:36 +04:00
/ *
* linux/ a r c h / a r m / m m / p r o c - x s c a l e . S
*
* Author : Nicolas P i t r e
* Created : November 2 0 0 0
* Copyright : ( C) 2 0 0 0 , 2 0 0 1 M o n t a V i s t a S o f t w a r e I n c .
*
* 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 .
*
* MMU f u n c t i o n s f o r t h e I n t e l X S c a l e C P U s
*
* 2 0 0 1 Aug 2 1 :
* some c o n t r i b u t i o n s b y B r e t t G a i n e s < b r e t t . w . g a i n e s @intel.com>
* Copyright 2 0 0 1 b y I n t e l C o r p .
*
* 2 0 0 1 Sep 0 8 :
* Completely r e v i s i t e d , m a n y i m p o r t a n t f i x e s
* Nicolas P i t r e < n i c o @cam.org>
* /
# 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 >
# include < a s m / a s s e m b l e r . h >
2006-11-09 17:20:47 +03:00
# include < a s m / e l f . h >
2005-04-17 02:20:36 +04:00
# include < a s m / p g t a b l e . h >
2006-03-26 01:08:55 +03:00
# include < a s m / p g t a b l e - h w d e f . h >
2005-04-17 02:20:36 +04:00
# include < a s m / p a g e . h >
# include < a s m / p t r a c e . h >
# include " p r o c - m a c r o s . S "
/ *
* This i s t h e m a x i m u m s i z e o f a n a r e a w h i c h w i l l b e f l u s h e d . I f t h e a r e a
* is l a r g e r t h a n t h i s , t h e n w e f l u s h t h e w h o l e c a c h e
* /
# define M A X _ A R E A _ S I Z E 3 2 7 6 8
/ *
* the c a c h e l i n e s i z e o f t h e I a n d D c a c h e
* /
# define C A C H E L I N E S I Z E 3 2
/ *
* the s i z e o f t h e d a t a c a c h e
* /
# define C A C H E S I Z E 3 2 7 6 8
/ *
* Virtual a d d r e s s u s e d t o a l l o c a t e t h e c a c h e w h e n f l u s h e d
*
* This m u s t b e a n a d d r e s s r a n g e w h i c h i s _ n e v e r _ u s e d . I t s h o u l d
* apparently h a v e a m a p p i n g i n t h e c o r r e s p o n d i n g p a g e t a b l e f o r
* compatibility w i t h f u t u r e C P U s t h a t _ c o u l d _ r e q u i r e i t . F o r i n s t a n c e w e
* don' t c a r e .
*
* This m u s t b e a l i g n e d o n a 2 * C A C H E S I Z E b o u n d a r y . T h e c o d e s e l e c t s o n e o f
* the 2 a r e a s i n a l t e r n a n c e e a c h t i m e t h e c l e a n _ d _ c a c h e m a c r o i s u s e d .
* Without t h i s t h e X S c a l e c o r e e x h i b i t s c a c h e e v i c t i o n p r o b l e m s a n d n o o n e
* knows w h y .
*
* Reminder : the v e c t o r t a b l e i s l o c a t e d a t 0 x f f f f00 0 0 - 0 x f f f f0 f f f .
* /
# define C L E A N _ A D D R 0 x f f f e 0 0 0 0
/ *
* This m a c r o i s u s e d t o w a i t f o r a C P 1 5 w r i t e a n d i s n e e d e d
* when w e h a v e t o e n s u r e t h a t t h e l a s t o p e r a t i o n t o t h e c o - p r o
* was c o m p l e t e d b e f o r e c o n t i n u i n g w i t h o p e r a t i o n .
* /
.macro cpwait, r d
mrc p15 , 0 , \ r d , c2 , c0 , 0 @ arbitrary read of cp15
mov \ r d , \ r d @ wait for completion
sub p c , p c , #4 @ flush instruction pipeline
.endm
.macro cpwait_ r e t , l r , r d
mrc p15 , 0 , \ r d , c2 , c0 , 0 @ arbitrary read of cp15
sub p c , \ l r , \ r d , L S R #32 @ wait for completion and
@ flush instruction pipeline
.endm
/ *
* This m a c r o c l e a n s t h e e n t i r e d c a c h e u s i n g l i n e a l l o c a t e .
* The m a i n l o o p h a s b e e n u n r o l l e d t o r e d u c e l o o p o v e r h e a d .
* rd a n d r s a r e t w o s c r a t c h r e g i s t e r s .
* /
.macro clean_ d _ c a c h e , r d , r s
ldr \ r s , =clean_addr
ldr \ r d , [ \ r s ]
eor \ r d , \ r d , #C A C H E S I Z E
str \ r d , [ \ r s ]
add \ r s , \ r d , #C A C H E S I Z E
1 : mcr p15 , 0 , \ r d , c7 , c2 , 5 @ allocate D cache line
add \ r d , \ r d , #C A C H E L I N E S I Z E
mcr p15 , 0 , \ r d , c7 , c2 , 5 @ allocate D cache line
add \ r d , \ r d , #C A C H E L I N E S I Z E
mcr p15 , 0 , \ r d , c7 , c2 , 5 @ allocate D cache line
add \ r d , \ r d , #C A C H E L I N E S I Z E
mcr p15 , 0 , \ r d , c7 , c2 , 5 @ allocate D cache line
add \ r d , \ r d , #C A C H E L I N E S I Z E
teq \ r d , \ r s
bne 1 b
.endm
.data
clean_addr : .word C L E A N _ A D D R
.text
/ *
* cpu_ x s c a l e _ p r o c _ i n i t ( )
*
* Nothing t o o e x c i t i n g a t t h e m o m e n t
* /
ENTRY( c p u _ x s c a l e _ p r o c _ i n i t )
2008-03-13 11:53:21 +03:00
@ enable write buffer coalescing. Some bootloader disable it
mrc p15 , 0 , r1 , c1 , c0 , 1
bic r1 , r1 , #1
mcr p15 , 0 , r1 , c1 , c0 , 1
2005-04-17 02:20:36 +04:00
mov p c , l r
/ *
* cpu_ x s c a l e _ p r o c _ f i n ( )
* /
ENTRY( c p u _ x s c a l e _ p r o c _ f i n )
str l r , [ s p , #- 4 ] !
mov r0 , #P S R _ F _ B I T | P S R _ I _ B I T | S V C _ M O D E
msr c p s r _ c , r0
bl x s c a l e _ f l u s h _ k e r n _ c a c h e _ a l l @ clean caches
mrc p15 , 0 , r0 , c1 , c0 , 0 @ ctrl register
bic r0 , r0 , #0x1800 @ ...IZ...........
bic r0 , r0 , #0x0006 @ .............CA.
mcr p15 , 0 , r0 , c1 , c0 , 0 @ disable caches
ldr p c , [ s p ] , #4
/ *
* cpu_ x s c a l e _ r e s e t ( l o c )
*
* Perform a s o f t r e s e t o f t h e s y s t e m . P u t t h e C P U i n t o t h e
* same s t a t e a s i t w o u l d b e i f i t h a d b e e n r e s e t , a n d b r a n c h
* to w h a t w o u l d b e t h e r e s e t v e c t o r .
*
* loc : location t o j u m p t o f o r s o f t r e s e t
2006-07-02 00:29:32 +04:00
*
* Beware P X A 2 7 0 e r r a t u m E 7 .
2005-04-17 02:20:36 +04:00
* /
.align 5
ENTRY( c p u _ x s c a l e _ r e s e t )
mov r1 , #P S R _ F _ B I T | P S R _ I _ B I T | S V C _ M O D E
msr c p s r _ c , r1 @ reset CPSR
2006-07-02 00:29:32 +04:00
mcr p15 , 0 , r1 , c10 , c4 , 1 @ unlock I-TLB
mcr p15 , 0 , r1 , c8 , c5 , 0 @ invalidate I-TLB
2005-04-17 02:20:36 +04:00
mrc p15 , 0 , r1 , c1 , c0 , 0 @ ctrl register
bic r1 , r1 , #0x0086 @ ........B....CA.
bic r1 , r1 , #0x3900 @ ..VIZ..S........
2006-07-02 00:29:32 +04:00
sub p c , p c , #4 @ flush pipeline
@ *** cache line aligned ***
2005-04-17 02:20:36 +04:00
mcr p15 , 0 , r1 , c1 , c0 , 0 @ ctrl register
bic r1 , r1 , #0x0001 @ ...............M
2006-07-02 00:29:32 +04:00
mcr p15 , 0 , i p , c7 , c7 , 0 @ invalidate I,D caches & BTB
2005-04-17 02:20:36 +04:00
mcr p15 , 0 , r1 , c1 , c0 , 0 @ ctrl register
@ CAUTION: MMU turned off from this point. We count on the pipeline
@ already containing those two last instructions to survive.
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I & D TLBs
mov p c , r0
/ *
* cpu_ x s c a l e _ d o _ i d l e ( )
*
* Cause t h e p r o c e s s o r t o i d l e
*
* For n o w w e d o n o t h i n g b u t g o t o i d l e m o d e f o r e v e r y c a s e
*
* XScale s u p p o r t s c l o c k s w i t c h i n g , b u t u s i n g i d l e m o d e s u p p o r t
* allows e x t e r n a l h a r d w a r e t o r e a c t t o s y s t e m s t a t e c h a n g e s .
* /
.align 5
ENTRY( c p u _ x s c a l e _ d o _ i d l e )
mov r0 , #1
mcr p14 , 0 , r0 , c7 , c0 , 0 @ Go to IDLE
mov p c , l r
/* ================================= CACHE ================================ */
/ *
* 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.
* /
ENTRY( x s c a l e _ 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( x s c a l e _ f l u s h _ k e r n _ c a c h e _ a l l )
mov r2 , #V M _ E X E C
mov i p , #0
__flush_whole_cache :
clean_ d _ c a c h e r0 , r1
tst r2 , #V M _ E X E C
mcrne p15 , 0 , i p , c7 , c5 , 0 @ Invalidate I cache & BTB
mcrne p15 , 0 , i p , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
/ *
* flush_ u s e r _ c a c h e _ r a n g e ( s t a r t , e n d , v m _ 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 )
* - vma - v m a _ a r e a _ 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
* /
.align 5
ENTRY( x s c a l e _ f l u s h _ u s e r _ c a c h e _ r a n g e )
mov i p , #0
sub r3 , r1 , r0 @ calculate total size
cmp r3 , #M A X _ A R E A _ S I Z E
bhs _ _ f l u s h _ w h o l e _ c a c h e
1 : tst r2 , #V M _ E X E C
mcrne p15 , 0 , r0 , c7 , c5 , 1 @ Invalidate I cache line
mcr p15 , 0 , r0 , c7 , c10 , 1 @ Clean D cache line
mcr p15 , 0 , r0 , c7 , c6 , 1 @ Invalidate D cache line
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
tst r2 , #V M _ E X E C
mcrne p15 , 0 , i p , c7 , c5 , 6 @ Invalidate BTB
mcrne p15 , 0 , i p , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
/ *
* 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
*
* Note : single I - c a c h e l i n e i n v a l i d a t i o n i s n ' t u s e d h e r e s i n c e
* it a l s o t r a s h e s t h e m i n i I - c a c h e u s e d b y J T A G d e b u g g e r s .
* /
ENTRY( x s c a l e _ c o h e r e n t _ k e r n _ r a n g e )
2006-02-01 22:26:01 +03:00
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c5 , 0 @ Invalidate I cache & BTB
mcr p15 , 0 , r0 , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
2005-04-17 02:20:36 +04:00
/ *
* 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( x s c a l e _ c o h e r e n t _ u s e r _ r a n g e )
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
2006-02-01 22:26:01 +03:00
mcr p15 , 0 , r0 , c7 , c5 , 1 @ Invalidate I cache entry
2005-04-17 02:20:36 +04:00
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mov r0 , #0
2006-02-01 22:26:01 +03:00
mcr p15 , 0 , r0 , c7 , c5 , 6 @ Invalidate BTB
2005-04-17 02:20:36 +04:00
mcr p15 , 0 , r0 , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
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( x s c a l e _ f l u s h _ k e r n _ d c a c h e _ p a g e )
add r1 , r0 , #P A G E _ S Z
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
mcr p15 , 0 , r0 , c7 , c6 , 1 @ invalidate D entry
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c5 , 0 @ Invalidate I cache & BTB
mcr p15 , 0 , r0 , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
/ *
* 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( x s c a l e _ d m a _ i n v _ r a n g e )
tst r0 , #C A C H E L I N E S I Z E - 1
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
mcrne p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
tst r1 , #C A C H E L I N E S I Z E - 1
mcrne p15 , 0 , r1 , c7 , c10 , 1 @ clean D entry
1 : mcr p15 , 0 , r0 , c7 , c6 , 1 @ invalidate D entry
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mcr p15 , 0 , r0 , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
/ *
* dma_ c l e a n _ r a n g e ( s t a r t , e n d )
*
* Clean 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( x s c a l e _ d m a _ c l e a n _ r a n g e )
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mcr p15 , 0 , r0 , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
/ *
* 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( x s c a l e _ d m a _ f l u s h _ r a n g e )
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
mcr p15 , 0 , r0 , c7 , c6 , 1 @ invalidate D entry
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mcr p15 , 0 , r0 , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
ENTRY( x s c a l e _ c a c h e _ f n s )
.long xscale_flush_kern_cache_all
.long xscale_flush_user_cache_all
.long xscale_flush_user_cache_range
.long xscale_coherent_kern_range
.long xscale_coherent_user_range
.long xscale_flush_kern_dcache_page
.long xscale_dma_inv_range
.long xscale_dma_clean_range
.long xscale_dma_flush_range
2006-09-16 13:52:02 +04:00
/ *
* On s t e p p i n g A 0 / A 1 o f t h e 8 0 2 0 0 , i n v a l i d a t i n g D - c a c h e b y l i n e d o e s n ' t
* clear t h e d i r t y b i t s , w h i c h m e a n s t h a t i f w e i n v a l i d a t e a d i r t y l i n e ,
* the d i r t y d a t a c a n s t i l l b e w r i t t e n b a c k t o e x t e r n a l m e m o r y l a t e r o n .
*
* The r e c o m m e n d e d w o r k a r o u n d i s t o a l w a y s d o a c l e a n D - c a c h e l i n e b e f o r e
* doing a n i n v a l i d a t e D - c a c h e l i n e , s o o n t h e a f f e c t e d p r o c e s s o r s ,
* dma_ i n v _ r a n g e ( ) i s i m p l e m e n t e d a s d m a _ f l u s h _ r a n g e ( ) .
*
* See e r r a t u m #25 o f " I n t e l 8 0 2 0 0 P r o c e s s o r S p e c i f i c a t i o n U p d a t e " ,
* revision J a n u a r y 2 2 , 2 0 0 3 , a v a i l a b l e a t :
* http : / / www. i n t e l . c o m / d e s i g n / i i o / s p e c u p d t / 2 7 3 4 1 5 . h t m
* /
ENTRY( x s c a l e _ 8 0 2 0 0 _ A 0 _ A 1 _ c a c h e _ f n s )
.long xscale_flush_kern_cache_all
.long xscale_flush_user_cache_all
.long xscale_flush_user_cache_range
.long xscale_coherent_kern_range
.long xscale_coherent_user_range
.long xscale_flush_kern_dcache_page
.long xscale_dma_flush_range
.long xscale_dma_clean_range
.long xscale_dma_flush_range
2005-04-17 02:20:36 +04:00
ENTRY( c p u _ x s c a l e _ d c a c h e _ c l e a n _ a r e a )
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
add r0 , r0 , #C A C H E L I N E S I Z E
subs r1 , r1 , #C A C H E L I N E S I Z E
bhi 1 b
mov p c , l r
/* =============================== PageTable ============================== */
# define P T E _ C A C H E _ W R I T E _ A L L O C A T E 0
/ *
* cpu_ x s c a l e _ s w i t c h _ m m ( p g d )
*
* Set t h e t r a n s l a t i o n b a s e p o i n t e r t o b e a s d e s c r i b e d b y p g d .
*
* pgd : new p a g e t a b l e s
* /
.align 5
ENTRY( c p u _ x s c a l e _ s w i t c h _ m m )
clean_ d _ c a c h e r1 , r2
mcr p15 , 0 , i p , c7 , c5 , 0 @ Invalidate I cache & BTB
mcr p15 , 0 , i p , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mcr p15 , 0 , r0 , c2 , c0 , 0 @ load page table pointer
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I & D TLBs
cpwait_ r e t l r , i p
/ *
2006-12-13 17:34:43 +03:00
* cpu_ x s c a l e _ s e t _ p t e _ e x t ( p t e p , p t e , e x t )
2005-04-17 02:20:36 +04:00
*
* Set a P T E a n d f l u s h i t o u t
*
* Errata 4 0 : m u s t s e t m e m o r y t o w r i t e - t h r o u g h f o r u s e r r e a d - o n l y p a g e s .
* /
.align 5
2006-12-13 17:34:43 +03:00
ENTRY( c p u _ x s c a l e _ s e t _ p t e _ e x t )
2005-04-17 02:20:36 +04:00
str r1 , [ r0 ] , #- 2048 @ linux version
bic r2 , r1 , #0xff0
orr r2 , r2 , #P T E _ T Y P E _ E X T @ e x t e n d e d p a g e
eor r3 , r1 , #L _ P T E _ P R E S E N T | L _ P T E _ Y O U N G | L _ P T E _ W R I T E | L _ P T E _ D I R T Y
tst r3 , #L _ P T E _ U S E R @ U s e r ?
orrne r2 , r2 , #P T E _ E X T _ A P _ U R O _ S R W @ y e s - > u s e r r / o , s y s t e m r / w
tst r3 , #L _ P T E _ W R I T E | L _ P T E _ D I R T Y @ W r i t e a n d D i r t y ?
orreq r2 , r2 , #P T E _ E X T _ A P _ U N O _ S R W @ y e s - > u s e r n / a , s y s t e m r / w
@ combined with user -> user r/w
@
@ Handle the X bit. We want to set this bit for the minicache
@ (U = E = B = W = 0, C = 1) or when write allocate is enabled,
@ and we have a writeable, cacheable region. If we ignore the
@ U and E bits, we can allow user space to use the minicache as
@ well.
@
@ X = (C & ~W & ~B) | (C & W & B & write_allocate)
@
eor i p , r1 , #L _ P T E _ C A C H E A B L E
tst i p , #L _ P T E _ C A C H E A B L E | L _ P T E _ W R I T E | L _ P T E _ B U F F E R A B L E
# if P T E _ C A C H E _ W R I T E _ A L L O C A T E
eorne i p , r1 , #L _ P T E _ C A C H E A B L E | L _ P T E _ W R I T E | L _ P T E _ B U F F E R A B L E
tstne i p , #L _ P T E _ C A C H E A B L E | L _ P T E _ W R I T E | L _ P T E _ B U F F E R A B L E
# endif
orreq r2 , r2 , #P T E _ E X T _ T E X ( 1 )
@
@ Erratum 40: The B bit must be cleared for a user read-only
@ cacheable page.
@
@ B = B & ~(U & C & ~W)
@
and i p , r1 , #L _ P T E _ U S E R | L _ P T E _ W R I T E | L _ P T E _ C A C H E A B L E
teq i p , #L _ P T E _ U S E R | L _ P T E _ C A C H E A B L E
biceq r2 , r2 , #P T E _ B U F F E R A B L E
tst r3 , #L _ P T E _ P R E S E N T | L _ P T E _ Y O U N G @ P r e s e n t a n d Y o u n g ?
movne r2 , #0 @ no -> fault
str r2 , [ r0 ] @ hardware version
mov i p , #0
mcr p15 , 0 , r0 , c7 , c10 , 1 @ Clean D cache line
mcr p15 , 0 , i p , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mov p c , l r
.ltorg
.align
_ _ INIT
.type _ _ xscale_ s e t u p , #f u n c t i o n
__xscale_setup :
mcr p15 , 0 , i p , c7 , c7 , 0 @ invalidate I, D caches & BTB
mcr p15 , 0 , i p , c7 , c10 , 4 @ Drain Write (& Fill) Buffer
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I, D TLBs
[ARM] 3881/4: xscale: clean up cp0/cp1 handling
XScale cores either have a DSP coprocessor (which contains a single
40 bit accumulator register), or an iWMMXt coprocessor (which contains
eight 64 bit registers.)
Because of the small amount of state in the DSP coprocessor, access to
the DSP coprocessor (CP0) is always enabled, and DSP context switching
is done unconditionally on every task switch. Access to the iWMMXt
coprocessor (CP0/CP1) is enabled only when an iWMMXt instruction is
first issued, and iWMMXt context switching is done lazily.
CONFIG_IWMMXT is supposed to mean 'the cpu we will be running on will
have iWMMXt support', but boards are supposed to select this config
symbol by hand, and at least one pxa27x board doesn't get this right,
so on that board, proc-xscale.S will incorrectly assume that we have a
DSP coprocessor, enable CP0 on boot, and we will then only save the
first iWMMXt register (wR0) on context switches, which is Bad.
This patch redefines CONFIG_IWMMXT as 'the cpu we will be running on
might have iWMMXt support, and we will enable iWMMXt context switching
if it does.' This means that with this patch, running a CONFIG_IWMMXT=n
kernel on an iWMMXt-capable CPU will no longer potentially corrupt iWMMXt
state over context switches, and running a CONFIG_IWMMXT=y kernel on a
non-iWMMXt capable CPU will still do DSP context save/restore.
These changes should make iWMMXt work on PXA3xx, and as a side effect,
enable proper acc0 save/restore on non-iWMMXt capable xsc3 cores such
as IOP13xx and IXP23xx (which will not have CONFIG_CPU_XSCALE defined),
as well as setting and using HWCAP_IWMMXT properly.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-12-03 20:51:14 +03:00
mov r0 , #1 < < 6 @ cp6 for IOP3xx and Bulverde
2005-04-17 02:20:36 +04:00
orr r0 , r0 , #1 < < 1 3 @ Its undefined whether this
mcr p15 , 0 , r0 , c15 , c1 , 0 @ affects USR or SVC modes
2006-06-29 18:09:57 +04:00
adr r5 , x s c a l e _ c r v a l
ldmia r5 , { r5 , r6 }
2005-04-17 02:20:36 +04:00
mrc p15 , 0 , r0 , c1 , c0 , 0 @ get control register
bic r0 , r0 , r5
2006-06-29 18:09:57 +04:00
orr r0 , r0 , r6
2005-04-17 02:20:36 +04:00
mov p c , l r
.size _ _ xscale_ s e t u p , . - _ _ x s c a l e _ s e t u p
/ *
* R
* .RVI ZFRS BLDP W C A M
* . .11 1 .01 . . . . .101
*
* /
2006-06-29 18:09:57 +04:00
.type xscale_ c r v a l , #o b j e c t
xscale_crval :
crval c l e a r =0x00003b07 , m m u s e t =0x00003905 , u c s e t =0x00001900
2005-04-17 02:20:36 +04:00
_ _ INITDATA
/ *
* Purpose : F u n c t i o n p o i n t e r s u s e d t o a c c e s s a b o v e f u n c t i o n s - a l l c a l l s
* come t h r o u g h t h e s e
* /
.type xscale_ p r o c e s s o r _ f u n c t i o n s , #o b j e c t
ENTRY( x s c a l e _ p r o c e s s o r _ f u n c t i o n s )
.word v5t_early_abort
2008-04-21 21:42:04 +04:00
.word pabort_noifar
2005-04-17 02:20:36 +04:00
.word cpu_xscale_proc_init
.word cpu_xscale_proc_fin
.word cpu_xscale_reset
.word cpu_xscale_do_idle
.word cpu_xscale_dcache_clean_area
.word cpu_xscale_switch_mm
2006-12-13 17:34:43 +03:00
.word cpu_xscale_set_pte_ext
2005-04-17 02:20:36 +04:00
.size xscale_ p r o c e s s o r _ f u n c t i o n s , . - x s c a l e _ p r o c e s s o r _ f u n c t i o n s
.section " .rodata "
.type cpu_ a r c h _ n a m e , #o b j e c t
cpu_arch_name :
.asciz " armv5 t e "
.size cpu_ a r c h _ n a m e , . - c p u _ a r c h _ n a m e
.type cpu_ e l f _ n a m e , #o b j e c t
cpu_elf_name :
.asciz " v5 "
.size cpu_ e l f _ n a m e , . - c p u _ e l f _ n a m e
2006-09-16 13:52:02 +04:00
.type cpu_ 8 0 2 0 0 _ A 0 _ A 1 _ n a m e , #o b j e c t
cpu_80200_A0_A1_name :
.asciz " XScale- 8 0 2 0 0 A 0 / A 1 "
.size cpu_ 8 0 2 0 0 _ A 0 _ A 1 _ n a m e , . - c p u _ 8 0 2 0 0 _ A 0 _ A 1 _ n a m e
2005-04-17 02:20:36 +04:00
.type cpu_ 8 0 2 0 0 _ n a m e , #o b j e c t
cpu_80200_name :
.asciz " XScale- 8 0 2 0 0 "
.size cpu_ 8 0 2 0 0 _ n a m e , . - c p u _ 8 0 2 0 0 _ n a m e
2006-07-29 11:29:26 +04:00
.type cpu_ 8 0 2 1 9 _ n a m e , #o b j e c t
cpu_80219_name :
.asciz " XScale- 8 0 2 1 9 "
.size cpu_ 8 0 2 1 9 _ n a m e , . - c p u _ 8 0 2 1 9 _ n a m e
2005-04-17 02:20:36 +04:00
.type cpu_ 8 0 3 2 x _ n a m e , #o b j e c t
cpu_8032x_name :
.asciz " XScale- I O P 8 0 3 2 x F a m i l y "
.size cpu_ 8 0 3 2 x _ n a m e , . - c p u _ 8 0 3 2 x _ n a m e
.type cpu_ 8 0 3 3 x _ n a m e , #o b j e c t
cpu_8033x_name :
.asciz " XScale- I O P 8 0 3 3 x F a m i l y "
.size cpu_ 8 0 3 3 x _ n a m e , . - c p u _ 8 0 3 3 x _ n a m e
.type cpu_ p x a25 0 _ n a m e , #o b j e c t
cpu_pxa250_name :
.asciz " XScale- P X A 2 5 0 "
.size cpu_ p x a25 0 _ n a m e , . - c p u _ p x a25 0 _ n a m e
.type cpu_ p x a21 0 _ n a m e , #o b j e c t
cpu_pxa210_name :
.asciz " XScale- P X A 2 1 0 "
.size cpu_ p x a21 0 _ n a m e , . - c p u _ p x a21 0 _ n a m e
.type cpu_ i x p42 x _ n a m e , #o b j e c t
cpu_ixp42x_name :
.asciz " XScale- I X P 4 2 x F a m i l y "
.size cpu_ i x p42 x _ n a m e , . - c p u _ i x p42 x _ n a m e
2007-04-06 18:00:31 +04:00
.type cpu_ i x p43 x _ n a m e , #o b j e c t
cpu_ixp43x_name :
.asciz " XScale- I X P 4 3 x F a m i l y "
.size cpu_ i x p43 x _ n a m e , . - c p u _ i x p43 x _ n a m e
2005-04-17 02:20:36 +04:00
.type cpu_ i x p46 x _ n a m e , #o b j e c t
cpu_ixp46x_name :
.asciz " XScale- I X P 4 6 x F a m i l y "
.size cpu_ i x p46 x _ n a m e , . - c p u _ i x p46 x _ n a m e
.type cpu_ i x p24 0 0 _ n a m e , #o b j e c t
cpu_ixp2400_name :
.asciz " XScale- I X P 2 4 0 0 "
.size cpu_ i x p24 0 0 _ n a m e , . - c p u _ i x p24 0 0 _ n a m e
.type cpu_ i x p28 0 0 _ n a m e , #o b j e c t
cpu_ixp2800_name :
.asciz " XScale- I X P 2 8 0 0 "
.size cpu_ i x p28 0 0 _ n a m e , . - c p u _ i x p28 0 0 _ n a m e
.type cpu_ p x a25 5 _ n a m e , #o b j e c t
cpu_pxa255_name :
.asciz " XScale- P X A 2 5 5 "
.size cpu_ p x a25 5 _ n a m e , . - c p u _ p x a25 5 _ n a m e
.type cpu_ p x a27 0 _ n a m e , #o b j e c t
cpu_pxa270_name :
.asciz " XScale- P X A 2 7 0 "
.size cpu_ p x a27 0 _ n a m e , . - c p u _ p x a27 0 _ n a m e
.align
2005-09-20 19:35:03 +04:00
.section " .proc .info .init " , # alloc, #e x e c i n s t r
2005-04-17 02:20:36 +04:00
2006-09-16 13:52:02 +04:00
.type _ _ 8 0 2 0 0 _ A0 _ A 1 _ p r o c _ i n f o ,#o b j e c t
__80200_A0_A1_proc_info :
.long 0x69052000
.long 0xfffffffe
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_80200_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_80200_A0_A1_cache_fns
.size _ _ 8 0 2 0 0 _ A0 _ A 1 _ p r o c _ i n f o , . - _ _ 8 0 2 0 0 _ A 0 _ A 1 _ p r o c _ i n f o
2005-04-17 02:20:36 +04:00
.type _ _ 8 0 2 0 0 _ proc_ i n f o ,#o b j e c t
__80200_proc_info :
.long 0x69052000
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_80200_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ 8 0 2 0 0 _ proc_ i n f o , . - _ _ 8 0 2 0 0 _ p r o c _ i n f o
2006-07-29 11:29:26 +04:00
.type _ _ 8 0 2 1 9 _ proc_ i n f o ,#o b j e c t
__80219_proc_info :
.long 0x69052e20
.long 0xffffffe0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_80219_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ 8 0 2 1 9 _ proc_ i n f o , . - _ _ 8 0 2 1 9 _ p r o c _ i n f o
2005-04-17 02:20:36 +04:00
.type _ _ 8 0 3 2 x_ p r o c _ i n f o ,#o b j e c t
__8032x_proc_info :
.long 0x69052420
2006-09-14 20:45:16 +04:00
.long 0xfffff7e0
2005-04-17 02:20:36 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_8032x_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ 8 0 3 2 x_ p r o c _ i n f o , . - _ _ 8 0 3 2 x _ p r o c _ i n f o
.type _ _ 8 0 3 3 x_ p r o c _ i n f o ,#o b j e c t
__8033x_proc_info :
.long 0x69054010
2007-01-18 22:36:00 +03:00
.long 0xfffffd30
2005-04-17 02:20:36 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_8033x_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ 8 0 3 3 x_ p r o c _ i n f o , . - _ _ 8 0 3 3 x _ p r o c _ i n f o
.type _ _ pxa2 5 0 _ p r o c _ i n f o ,#o b j e c t
__pxa250_proc_info :
.long 0x69052100
.long 0xfffff7f0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_pxa250_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ pxa2 5 0 _ p r o c _ i n f o , . - _ _ p x a25 0 _ p r o c _ i n f o
.type _ _ pxa2 1 0 _ p r o c _ i n f o ,#o b j e c t
__pxa210_proc_info :
.long 0x69052120
.long 0xfffff3f0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_pxa210_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ pxa2 1 0 _ p r o c _ i n f o , . - _ _ p x a21 0 _ p r o c _ i n f o
.type _ _ ixp2 4 0 0 _ p r o c _ i n f o , #o b j e c t
__ixp2400_proc_info :
.long 0x69054190
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_ixp2400_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ ixp2 4 0 0 _ p r o c _ i n f o , . - _ _ i x p24 0 0 _ p r o c _ i n f o
.type _ _ ixp2 8 0 0 _ p r o c _ i n f o , #o b j e c t
__ixp2800_proc_info :
.long 0x690541a0
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_ixp2800_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ ixp2 8 0 0 _ p r o c _ i n f o , . - _ _ i x p28 0 0 _ p r o c _ i n f o
.type _ _ ixp4 2 x _ p r o c _ i n f o , #o b j e c t
__ixp42x_proc_info :
.long 0x690541c0
.long 0xffffffc0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_ixp42x_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ ixp4 2 x _ p r o c _ i n f o , . - _ _ i x p42 x _ p r o c _ i n f o
2007-04-06 18:00:31 +04:00
.type _ _ ixp4 3 x _ p r o c _ i n f o , #o b j e c t
__ixp43x_proc_info :
.long 0x69054040
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_ixp43x_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ ixp4 3 x _ p r o c _ i n f o , . - _ _ i x p43 x _ p r o c _ i n f o
2005-04-17 02:20:36 +04:00
.type _ _ ixp4 6 x _ p r o c _ i n f o , #o b j e c t
__ixp46x_proc_info :
.long 0x69054200
.long 0xffffff00
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_ixp46x_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ ixp4 6 x _ p r o c _ i n f o , . - _ _ i x p46 x _ p r o c _ i n f o
.type _ _ pxa2 5 5 _ p r o c _ i n f o ,#o b j e c t
__pxa255_proc_info :
.long 0x69052d00
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_pxa255_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ pxa2 5 5 _ p r o c _ i n f o , . - _ _ p x a25 5 _ p r o c _ i n f o
.type _ _ pxa2 7 0 _ p r o c _ i n f o ,#o b j e c t
__pxa270_proc_info :
.long 0x69054110
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2006-06-29 21:24:21 +04:00
.long PMD_TYPE_SECT | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2005-04-17 02:20:36 +04:00
b _ _ x s c a l e _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
[ARM] 3881/4: xscale: clean up cp0/cp1 handling
XScale cores either have a DSP coprocessor (which contains a single
40 bit accumulator register), or an iWMMXt coprocessor (which contains
eight 64 bit registers.)
Because of the small amount of state in the DSP coprocessor, access to
the DSP coprocessor (CP0) is always enabled, and DSP context switching
is done unconditionally on every task switch. Access to the iWMMXt
coprocessor (CP0/CP1) is enabled only when an iWMMXt instruction is
first issued, and iWMMXt context switching is done lazily.
CONFIG_IWMMXT is supposed to mean 'the cpu we will be running on will
have iWMMXt support', but boards are supposed to select this config
symbol by hand, and at least one pxa27x board doesn't get this right,
so on that board, proc-xscale.S will incorrectly assume that we have a
DSP coprocessor, enable CP0 on boot, and we will then only save the
first iWMMXt register (wR0) on context switches, which is Bad.
This patch redefines CONFIG_IWMMXT as 'the cpu we will be running on
might have iWMMXt support, and we will enable iWMMXt context switching
if it does.' This means that with this patch, running a CONFIG_IWMMXT=n
kernel on an iWMMXt-capable CPU will no longer potentially corrupt iWMMXt
state over context switches, and running a CONFIG_IWMMXT=y kernel on a
non-iWMMXt capable CPU will still do DSP context save/restore.
These changes should make iWMMXt work on PXA3xx, and as a side effect,
enable proper acc0 save/restore on non-iWMMXt capable xsc3 cores such
as IOP13xx and IXP23xx (which will not have CONFIG_CPU_XSCALE defined),
as well as setting and using HWCAP_IWMMXT properly.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-12-03 20:51:14 +03:00
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
2005-04-17 02:20:36 +04:00
.long cpu_pxa270_name
.long xscale_processor_functions
.long v4wbi_tlb_fns
.long xscale_mc_user_fns
.long xscale_cache_fns
.size _ _ pxa2 7 0 _ p r o c _ i n f o , . - _ _ p x a27 0 _ p r o c _ i n f o