2007-05-08 22:27:46 +01:00
/ *
* linux/ a r c h / a r m / m m / p r o c - v7 . S
*
* Copyright ( C ) 2 0 0 1 D e e p B l u e S o l u t i o n s L t d .
*
* 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 .
*
* This i s t h e " s h e l l " o f t h e A R M v7 p r o c e s s o r s u p p o r t .
* /
2009-04-27 14:02:22 -04:00
# include < l i n u x / i n i t . h >
2007-05-08 22:27:46 +01:00
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
# include < a s m / a s m - o f f s e t s . h >
2008-09-07 19:15:31 +01:00
# include < a s m / h w c a p . h >
2007-05-08 22:27:46 +01:00
# include < a s m / p g t a b l e - h w d e f . h >
# include < a s m / p g t a b l e . h >
# include " p r o c - m a c r o s . S "
# define T T B _ S ( 1 < < 1 )
2008-11-06 13:23:09 +00:00
# define T T B _ R G N _ N C ( 0 < < 3 )
# define T T B _ R G N _ O C _ W B W A ( 1 < < 3 )
2007-05-08 22:27:46 +01:00
# define T T B _ R G N _ O C _ W T ( 2 < < 3 )
# define T T B _ R G N _ O C _ W B ( 3 < < 3 )
2009-05-30 14:00:15 +01:00
# define T T B _ N O S ( 1 < < 5 )
# define T T B _ I R G N _ N C ( ( 0 < < 0 ) | ( 0 < < 6 ) )
# define T T B _ I R G N _ W B W A ( ( 0 < < 0 ) | ( 1 < < 6 ) )
# define T T B _ I R G N _ W T ( ( 1 < < 0 ) | ( 0 < < 6 ) )
# define T T B _ I R G N _ W B ( ( 1 < < 0 ) | ( 1 < < 6 ) )
2007-05-08 22:27:46 +01:00
2009-05-30 14:00:15 +01:00
/* PTWs cacheable, inner WB not shareable, outer WB not shareable */
2010-09-04 10:47:48 +01:00
# define T T B _ F L A G S _ U P T T B _ I R G N _ W B | T T B _ R G N _ O C _ W B
# define P M D _ F L A G S _ U P P M D _ S E C T _ W B
2009-05-30 14:00:15 +01:00
/* PTWs cacheable, inner WBWA shareable, outer WBWA not shareable */
2010-09-04 10:47:48 +01:00
# define T T B _ F L A G S _ S M P T T B _ I R G N _ W B W A | T T B _ S | T T B _ N O S | T T B _ R G N _ O C _ W B W A
# define P M D _ F L A G S _ S M P P M D _ S E C T _ W B W A | P M D _ S E C T _ S
2008-11-06 13:23:09 +00:00
2007-05-08 22:27:46 +01:00
ENTRY( c p u _ v7 _ p r o c _ i n i t )
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( c p u _ v7 _ p r o c _ i n i t )
2007-05-08 22:27:46 +01:00
ENTRY( c p u _ v7 _ p r o c _ f i n )
2010-01-19 17:01:33 +01:00
mrc p15 , 0 , r0 , c1 , c0 , 0 @ ctrl register
bic r0 , r0 , #0x1000 @ ...i............
bic r0 , r0 , #0x0006 @ .............ca.
mcr p15 , 0 , r0 , c1 , c0 , 0 @ disable caches
2010-07-26 12:22:12 +01:00
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( c p u _ v7 _ p r o c _ f i n )
2007-05-08 22:27:46 +01:00
/ *
* cpu_ v7 _ 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 - l o c a t i o n t o j u m p t o f o r s o f t r e s e t
2011-06-06 12:27:34 +01:00
*
* This c o d e m u s t b e e x e c u t e d u s i n g a f l a t i d e n t i t y m a p p i n g w i t h
* caches d i s a b l e d .
2007-05-08 22:27:46 +01:00
* /
.align 5
ENTRY( c p u _ v7 _ r e s e t )
2011-06-06 12:27:34 +01:00
mrc p15 , 0 , r1 , c1 , c0 , 0 @ ctrl register
bic r1 , r1 , #0x1 @ ...............m
2011-08-26 16:34:51 +01:00
THUMB( b i c r1 , r1 , #1 < < 3 0 ) @ SCTLR.TE (Thumb exceptions)
2011-06-06 12:27:34 +01:00
mcr p15 , 0 , r1 , c1 , c0 , 0 @ disable MMU
isb
2007-05-08 22:27:46 +01:00
mov p c , r0
2008-08-28 11:22:32 +01:00
ENDPROC( c p u _ v7 _ r e s e t )
2007-05-08 22:27:46 +01:00
/ *
* cpu_ v7 _ d o _ i d l e ( )
*
* Idle t h e p r o c e s s o r ( e g , w a i t f o r i n t e r r u p t ) .
*
* IRQs a r e a l r e a d y d i s a b l e d .
* /
ENTRY( c p u _ v7 _ d o _ i d l e )
2008-11-10 14:14:11 +00:00
dsb @ WFI may enter a low-power mode
2008-10-03 11:09:10 +01:00
wfi
2007-05-08 22:27:46 +01:00
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( c p u _ v7 _ d o _ i d l e )
2007-05-08 22:27:46 +01:00
ENTRY( c p u _ v7 _ d c a c h e _ c l e a n _ a r e a )
# ifndef T L B _ C A N _ R E A D _ F R O M _ L 1 _ C A C H E
dcache_ l i n e _ s i z e r2 , r3
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
add r0 , r0 , r2
subs r1 , r1 , r2
bhi 1 b
dsb
# endif
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( c p u _ v7 _ d c a c h e _ c l e a n _ a r e a )
2007-05-08 22:27:46 +01:00
/ *
* cpu_ v7 _ s w i t c h _ m m ( p g d _ p h y s , t s k )
*
* Set t h e t r a n s l a t i o n t a b l e b a s e p o i n t e r t o b e p g d _ p h y s
*
* - pgd_ p h y s - p h y s i c a l a d d r e s s o f n e w T T B
*
* It i s a s s u m e d t h a t :
* - we a r e n o t u s i n g s p l i t p a g e t a b l e s
* /
ENTRY( c p u _ v7 _ s w i t c h _ m m )
2007-07-20 11:43:02 +01:00
# ifdef C O N F I G _ M M U
2007-05-08 22:27:46 +01:00
mov r2 , #0
ldr r1 , [ r1 , #M M _ C O N T E X T _ I D ] @ g e t m m - > c o n t e x t . i d
2010-09-04 10:47:48 +01:00
ALT_ S M P ( o r r r0 , r0 , #T T B _ F L A G S _ S M P )
ALT_ U P ( o r r r0 , r0 , #T T B _ F L A G S _ U P )
2009-04-30 17:06:09 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 4 3 0 9 7 3
mcr p15 , 0 , r2 , c7 , c5 , 6 @ flush BTAC/BTB
2011-02-28 18:15:16 +01:00
# endif
2011-06-09 10:10:27 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 5 4 3 2 2
dsb
# endif
mcr p15 , 0 , r2 , c13 , c0 , 1 @ set reserved context ID
isb
1 : mcr p15 , 0 , r0 , c2 , c0 , 0 @ set TTB 0
2007-05-08 22:27:46 +01:00
isb
2011-02-28 18:15:16 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 5 4 3 2 2
dsb
# endif
2007-05-08 22:27:46 +01:00
mcr p15 , 0 , r1 , c13 , c0 , 1 @ set context ID
isb
2007-07-20 11:43:02 +01:00
# endif
2007-05-08 22:27:46 +01:00
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( c p u _ v7 _ s w i t c h _ m m )
2007-05-08 22:27:46 +01:00
/ *
* cpu_ v7 _ s e t _ p t e _ e x t ( p t e p , p t e )
*
* Set a l e v e l 2 t r a n s l a t i o n t a b l e e n t r y .
*
* - ptep - p o i n t e r t o l e v e l 2 t r a n s l a t i o n t a b l e e n t r y
2010-11-16 00:16:01 +00:00
* ( hardware v e r s i o n i s s t o r e d a t + 2 0 4 8 b y t e s )
2007-05-08 22:27:46 +01:00
* - pte - P T E v a l u e t o s t o r e
* - ext - v a l u e f o r e x t e n d e d P T E b i t s
* /
ENTRY( c p u _ v7 _ s e t _ p t e _ e x t )
2007-07-20 11:43:02 +01:00
# ifdef C O N F I G _ M M U
2010-11-16 00:16:01 +00:00
str r1 , [ r0 ] @ linux version
2007-05-08 22:27:46 +01:00
bic r3 , r1 , #0x000003f0
2008-09-15 17:23:10 +01:00
bic r3 , r3 , #P T E _ T Y P E _ M A S K
2007-05-08 22:27:46 +01:00
orr r3 , r3 , r2
orr r3 , r3 , #P T E _ E X T _ A P 0 | 2
[ARM] mm: fix page table initialization
As a result of the ptebits changes, we ended up marking device mappings
as normal memory on ARMv7 CPUs, resulting in undesirable behaviour with
serial ports and the like. While reviewing the section mapping table
entries, other errors in the memory type settings for devices were
detected and confirmed to prevent Xscale3 platforms booting.
Tested on:
OMAP34xx (ARMv7),
OMAP24xx (ARMv6),
OMAP16xx (ARM926T, ARMv5),
PXA311 (Xscale3),
PXA272 (Xscale),
PXA255 (Xscale),
IXP42x (Xscale),
S3C2410 (ARM920T, ARMv4T),
ARM720T (ARMv4T)
StrongARM-110 (ARMv4)
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Mike Rapoport <mike@compulab.co.il>
Tested-by: Ben Dooks <ben-linux@fluff.org>
Tested-by: Anders Grafström <grfstrm@users.sourceforge.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-11-04 10:52:28 +00:00
tst r1 , #1 < < 4
2008-09-15 17:23:10 +01:00
orrne r3 , r3 , #P T E _ E X T _ T E X ( 1 )
2010-11-16 08:40:36 +00:00
eor r1 , r1 , #L _ P T E _ D I R T Y
tst r1 , #L _ P T E _ R D O N L Y | L _ P T E _ D I R T Y
orrne r3 , r3 , #P T E _ E X T _ A P X
2007-05-08 22:27:46 +01:00
tst r1 , #L _ P T E _ U S E R
orrne r3 , r3 , #P T E _ E X T _ A P 1
2010-09-13 16:03:21 +01:00
# ifdef C O N F I G _ C P U _ U S E _ D O M A I N S
@ allow kernel read/write access to read-only user pages
2007-05-08 22:27:46 +01:00
tstne r3 , #P T E _ E X T _ A P X
bicne r3 , r3 , #P T E _ E X T _ A P X | P T E _ E X T _ A P 0
2010-09-13 16:03:21 +01:00
# endif
2007-05-08 22:27:46 +01:00
2010-11-16 00:23:31 +00:00
tst r1 , #L _ P T E _ X N
orrne r3 , r3 , #P T E _ E X T _ X N
2007-05-08 22:27:46 +01:00
2008-09-15 17:23:10 +01:00
tst r1 , #L _ P T E _ Y O U N G
tstne r1 , #L _ P T E _ P R E S E N T
2007-05-08 22:27:46 +01:00
moveq r3 , #0
2011-01-14 00:43:01 +01:00
ARM( s t r r3 , [ r0 , #2048 ] ! )
THUMB( a d d r0 , r0 , #2048 )
THUMB( s t r r3 , [ r0 ] )
2007-05-08 22:27:46 +01:00
mcr p15 , 0 , r0 , c7 , c10 , 1 @ flush_pte
2007-07-20 11:43:02 +01:00
# endif
2007-05-08 22:27:46 +01:00
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( c p u _ v7 _ s e t _ p t e _ e x t )
2007-05-08 22:27:46 +01:00
2011-06-23 17:26:19 +01:00
string c p u _ v7 _ n a m e , " A R M v7 P r o c e s s o r "
2007-05-08 22:27:46 +01:00
.align
2011-02-06 15:48:39 +00:00
/ *
* Memory r e g i o n a t t r i b u t e s w i t h S C T L R . T R E =1
*
* n = T E X [ 0 ] ,C ,B
* TR = P R R R [ 2 n + 1 : 2 n ] - m e m o r y t y p e
* IR = N M R R [ 2 n + 1 : 2 n ] - i n n e r c a c h e a b l e p r o p e r t y
* OR = N M R R [ 2 n + 1 7 : 2 n + 1 6 ] - o u t e r c a c h e a b l e p r o p e r t y
*
* n T R I R O R
* UNCACHED 0 0 0 0 0
* BUFFERABLE 0 0 1 1 0 0 0 0 0
* WRITETHROUGH 0 1 0 1 0 1 0 1 0
* WRITEBACK 0 1 1 1 0 1 1 1 1
* reserved 1 1 0
* WRITEALLOC 1 1 1 1 0 0 1 0 1
* DEV_ S H A R E D 1 0 0 0 1
* DEV_ N O N S H A R E D 1 0 0 0 1
* DEV_ W C 0 0 1 1 0
* DEV_ C A C H E D 0 1 1 1 0
*
* Other a t t r i b u t e s :
*
* DS0 = P R R R [ 1 6 ] = 0 - d e v i c e s h a r e a b l e p r o p e r t y
* DS1 = P R R R [ 1 7 ] = 1 - d e v i c e s h a r e a b l e p r o p e r t y
* NS0 = P R R R [ 1 8 ] = 0 - n o r m a l s h a r e a b l e p r o p e r t y
* NS1 = P R R R [ 1 9 ] = 1 - n o r m a l s h a r e a b l e p r o p e r t y
* NOS = P R R R [ 2 4 + n ] = 1 - n o t o u t e r s h a r e a b l e
* /
.equ PRRR, 0 x f f0 a81 a8
.equ NMRR, 0 x40 e 0 4 0 e 0
/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
.globl cpu_v7_suspend_size
2011-06-22 15:41:58 +01:00
.equ cpu_ v7 _ s u s p e n d _ s i z e , 4 * 9
2011-04-02 10:08:55 +01:00
# ifdef C O N F I G _ P M _ S L E E P
2011-02-06 15:48:39 +00:00
ENTRY( c p u _ v7 _ d o _ s u s p e n d )
stmfd s p ! , { r4 - r11 , l r }
mrc p15 , 0 , r4 , c13 , c0 , 0 @ FCSE/PID
mrc p15 , 0 , r5 , c13 , c0 , 1 @ Context ID
2011-06-22 15:41:58 +01:00
mrc p15 , 0 , r6 , c13 , c0 , 3 @ User r/o thread ID
stmia r0 ! , { r4 - r6 }
2011-02-06 15:48:39 +00:00
mrc p15 , 0 , r6 , c3 , c0 , 0 @ Domain ID
mrc p15 , 0 , r7 , c2 , c0 , 0 @ TTB 0
mrc p15 , 0 , r8 , c2 , c0 , 1 @ TTB 1
mrc p15 , 0 , r9 , c1 , c0 , 0 @ Control register
mrc p15 , 0 , r10 , c1 , c0 , 1 @ Auxiliary control register
mrc p15 , 0 , r11 , c1 , c0 , 2 @ Co-processor access control
2011-06-22 15:41:58 +01:00
stmia r0 , { r6 - r11 }
2011-02-06 15:48:39 +00:00
ldmfd s p ! , { r4 - r11 , p c }
ENDPROC( c p u _ v7 _ d o _ s u s p e n d )
ENTRY( c p u _ v7 _ d o _ r e s u m e )
mov i p , #0
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate TLBs
mcr p15 , 0 , i p , c7 , c5 , 0 @ invalidate I cache
2011-06-22 15:41:58 +01:00
ldmia r0 ! , { r4 - r6 }
2011-02-06 15:48:39 +00:00
mcr p15 , 0 , r4 , c13 , c0 , 0 @ FCSE/PID
mcr p15 , 0 , r5 , c13 , c0 , 1 @ Context ID
2011-06-22 15:41:58 +01:00
mcr p15 , 0 , r6 , c13 , c0 , 3 @ User r/o thread ID
ldmia r0 , { r6 - r11 }
2011-02-06 15:48:39 +00:00
mcr p15 , 0 , r6 , c3 , c0 , 0 @ Domain ID
mcr p15 , 0 , r7 , c2 , c0 , 0 @ TTB 0
mcr p15 , 0 , r8 , c2 , c0 , 1 @ TTB 1
mcr p15 , 0 , i p , c2 , c0 , 2 @ TTB control register
2011-03-30 22:57:33 -03:00
mcr p15 , 0 , r10 , c1 , c0 , 1 @ Auxiliary control register
2011-02-06 15:48:39 +00:00
mcr p15 , 0 , r11 , c1 , c0 , 2 @ Co-processor access control
ldr r4 , =PRRR @ PRRR
ldr r5 , =NMRR @ NMRR
mcr p15 , 0 , r4 , c10 , c2 , 0 @ write PRRR
mcr p15 , 0 , r5 , c10 , c2 , 1 @ write NMRR
isb
2011-08-27 00:37:38 +01:00
dsb
2011-02-06 15:48:39 +00:00
mov r0 , r9 @ control register
mov r2 , r7 , l s r #14 @ get TTB0 base
mov r2 , r2 , l s l #14
ldr r3 , c p u _ r e s u m e _ l 1 _ f l a g s
b c p u _ r e s u m e _ m m u
ENDPROC( c p u _ v7 _ d o _ r e s u m e )
cpu_resume_l1_flags :
ALT_ S M P ( . l o n g P M D _ T Y P E _ S E C T | P M D _ S E C T _ A P _ W R I T E | P M D _ F L A G S _ S M P )
ALT_ U P ( . l o n g P M D _ T Y P E _ S E C T | P M D _ S E C T _ A P _ W R I T E | P M D _ F L A G S _ U P )
# endif
2010-10-01 15:37:05 +01:00
_ _ CPUINIT
2007-05-08 22:27:46 +01:00
/ *
* _ _ v7 _ s e t u p
*
* Initialise T L B , C a c h e s , a n d M M U s t a t e r e a d y t o s w i t c h t h e M M U
* on. R e t u r n i n r0 t h e n e w C P 1 5 C 1 c o n t r o l r e g i s t e r s e t t i n g .
*
* We a u t o m a t i c a l l y d e t e c t i f w e h a v e a H a r v a r d c a c h e , a n d u s e t h e
* Harvard c a c h e c o n t r o l i n s t r u c t i o n s i n s e a d o f t h e u n i f i e d c a c h e
* control i n s t r u c t i o n s .
*
* This s h o u l d b e a b l e t o c o v e r a l l A R M v7 c o r e s .
*
* It i s a s s u m e d t h a t :
* - cache t y p e r e g i s t e r i s i m p l e m e n t e d
* /
2011-05-20 14:39:29 +01:00
__v7_ca5mp_setup :
2010-09-17 16:42:10 +01:00
__v7_ca9mp_setup :
2011-01-12 17:10:45 +00:00
mov r10 , #( 1 < < 0 ) @ TLB ops broadcasting
b 1 f
__v7_ca15mp_setup :
mov r10 , #0
1 :
2008-11-06 13:23:09 +00:00
# ifdef C O N F I G _ S M P
2010-09-04 10:47:48 +01:00
ALT_ S M P ( m r c p15 , 0 , r0 , c1 , c0 , 1 )
ALT_ U P ( m o v r0 , #( 1 < < 6 ) ) @ fake it for UP
2009-11-04 12:16:38 +00:00
tst r0 , #( 1 < < 6 ) @ SMP/nAMP mode enabled?
2011-01-12 17:10:45 +00:00
orreq r0 , r0 , #( 1 < < 6 ) @ Enable SMP/nAMP mode
orreq r0 , r0 , r10 @ Enable CPU-specific SMP bits
mcreq p15 , 0 , r0 , c1 , c0 , 1
2008-11-06 13:23:09 +00:00
# endif
2010-09-17 16:42:10 +01:00
__v7_setup :
2007-05-08 22:27:46 +01:00
adr r12 , _ _ v7 _ s e t u p _ s t a c k @ the local stack
stmia r12 , { r0 - r5 , r7 , r9 , r11 , l r }
bl v7 _ f l u s h _ d c a c h e _ a l l
ldmia r12 , { r0 - r5 , r7 , r9 , r11 , l r }
2009-06-01 12:50:33 +01:00
mrc p15 , 0 , r0 , c0 , c0 , 0 @ read main ID register
and r10 , r0 , #0xff000000 @ ARM?
teq r10 , #0x41000000
2010-09-14 09:51:43 +01:00
bne 3 f
2009-06-01 12:50:33 +01:00
and r5 , r0 , #0x00f00000 @ variant
and r6 , r0 , #0x0000000f @ revision
2010-09-14 09:50:03 +01:00
orr r6 , r6 , r5 , l s r #20 - 4 @ combine variant and revision
ubfx r0 , r0 , #4 , #12 @ primary part number
2009-06-01 12:50:33 +01:00
2010-09-14 09:50:03 +01:00
/* Cortex-A8 Errata */
ldr r10 , =0x00000c08 @ Cortex-A8 primary part number
teq r0 , r10
bne 2 f
2009-04-30 17:06:09 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 4 3 0 9 7 3
2009-06-01 12:50:33 +01:00
teq r5 , #0x00100000 @ only present in r1p*
mrceq p15 , 0 , r10 , c1 , c0 , 1 @ read aux control register
orreq r10 , r10 , #( 1 < < 6 ) @ set IBE to 1
mcreq p15 , 0 , r10 , c1 , c0 , 1 @ write aux control register
2009-04-30 17:06:15 +01:00
# endif
# ifdef C O N F I G _ A R M _ E R R A T A _ 4 5 8 6 9 3
2010-09-14 09:50:03 +01:00
teq r6 , #0x20 @ only present in r2p0
2009-06-01 12:50:33 +01:00
mrceq p15 , 0 , r10 , c1 , c0 , 1 @ read aux control register
orreq r10 , r10 , #( 1 < < 5 ) @ set L1NEON to 1
orreq r10 , r10 , #( 1 < < 9 ) @ set PLDNOP to 1
mcreq p15 , 0 , r10 , c1 , c0 , 1 @ write aux control register
2009-04-30 17:06:20 +01:00
# endif
# ifdef C O N F I G _ A R M _ E R R A T A _ 4 6 0 0 7 5
2010-09-14 09:50:03 +01:00
teq r6 , #0x20 @ only present in r2p0
2009-06-01 12:50:33 +01:00
mrceq p15 , 1 , r10 , c9 , c0 , 2 @ read L2 cache aux ctrl register
tsteq r10 , #1 < < 2 2
orreq r10 , r10 , #( 1 < < 2 2 ) @ set the Write Allocate disable bit
mcreq p15 , 1 , r10 , c9 , c0 , 2 @ write the L2 cache aux ctrl register
2009-04-30 17:06:09 +01:00
# endif
2010-09-14 09:51:43 +01:00
b 3 f
/* Cortex-A9 Errata */
2 : ldr r10 , =0x00000c09 @ Cortex-A9 primary part number
teq r0 , r10
bne 3 f
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 4 2 2 3 0
cmp r6 , #0x22 @ only present up to r2p2
mrcle p15 , 0 , r10 , c15 , c0 , 1 @ read diagnostic register
orrle r10 , r10 , #1 < < 4 @ set bit #4
mcrle p15 , 0 , r10 , c15 , c0 , 1 @ write diagnostic register
# endif
2010-09-14 09:53:02 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 4 2 2 3 1
teq r6 , #0x20 @ present in r2p0
teqne r6 , #0x21 @ present in r2p1
teqne r6 , #0x22 @ present in r2p2
mrceq p15 , 0 , r10 , c15 , c0 , 1 @ read diagnostic register
orreq r10 , r10 , #1 < < 1 2 @ set bit #12
orreq r10 , r10 , #1 < < 2 2 @ set bit #22
mcreq p15 , 0 , r10 , c15 , c0 , 1 @ write diagnostic register
# endif
2010-09-28 14:02:02 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 4 3 6 2 2
teq r6 , #0x20 @ present in r2p0
teqne r6 , #0x21 @ present in r2p1
teqne r6 , #0x22 @ present in r2p2
mrceq p15 , 0 , r10 , c15 , c0 , 1 @ read diagnostic register
orreq r10 , r10 , #1 < < 6 @ set bit #6
mcreq p15 , 0 , r10 , c15 , c0 , 1 @ write diagnostic register
# endif
2011-02-18 16:36:35 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 5 1 4 7 2
cmp r6 , #0x30 @ present prior to r3p0
mrclt p15 , 0 , r10 , c15 , c0 , 1 @ read diagnostic register
orrlt r10 , r10 , #1 < < 1 1 @ set bit #11
mcrlt p15 , 0 , r10 , c15 , c0 , 1 @ write diagnostic register
# endif
2009-06-01 12:50:33 +01:00
2010-09-14 09:51:43 +01:00
3 : mov r10 , #0
2007-05-08 22:27:46 +01:00
# ifdef H A R V A R D _ C A C H E
mcr p15 , 0 , r10 , c7 , c5 , 0 @ I+BTB cache invalidate
# endif
dsb
2007-07-20 11:43:02 +01:00
# ifdef C O N F I G _ M M U
2007-05-08 22:27:46 +01:00
mcr p15 , 0 , r10 , c8 , c7 , 0 @ invalidate I + D TLBs
mcr p15 , 0 , r10 , c2 , c0 , 2 @ TTB control register
2010-09-04 10:47:48 +01:00
ALT_ S M P ( o r r r4 , r4 , #T T B _ F L A G S _ S M P )
ALT_ U P ( o r r r4 , r4 , #T T B _ F L A G S _ U P )
2011-05-26 11:22:44 +01:00
ALT_ S M P ( o r r r8 , r8 , #T T B _ F L A G S _ S M P )
ALT_ U P ( o r r r8 , r8 , #T T B _ F L A G S _ U P )
mcr p15 , 0 , r8 , c2 , c0 , 1 @ load TTB1
2011-02-06 15:48:39 +00:00
ldr r5 , =PRRR @ PRRR
ldr r6 , =NMRR @ NMRR
2008-09-15 17:23:10 +01:00
mcr p15 , 0 , r5 , c10 , c2 , 0 @ write PRRR
mcr p15 , 0 , r6 , c10 , c2 , 1 @ write NMRR
2009-07-24 12:35:06 +01:00
# endif
2007-07-20 11:43:02 +01:00
adr r5 , v7 _ c r v a l
ldmia r5 , { r5 , r6 }
2009-05-30 14:00:18 +01:00
# ifdef C O N F I G _ C P U _ E N D I A N _ B E 8
orr r6 , r6 , #1 < < 2 5 @ big-endian page tables
2010-09-16 18:00:47 +01:00
# endif
# ifdef C O N F I G _ S W P _ E M U L A T E
orr r5 , r5 , #( 1 < < 1 0 ) @ set SW bit in "clear"
bic r6 , r6 , #( 1 < < 1 0 ) @ clear it in "mmuset"
2009-05-30 14:00:18 +01:00
# endif
2007-07-20 11:43:02 +01:00
mrc p15 , 0 , r0 , c1 , c0 , 0 @ read control register
bic r0 , r0 , r5 @ clear bits them
orr r0 , r0 , r6 @ set them
2009-07-24 12:32:56 +01:00
THUMB( o r r r0 , r0 , #1 < < 3 0 ) @ Thumb exceptions
2007-05-08 22:27:46 +01:00
mov p c , l r @ return to head.S:__ret
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ v7 _ s e t u p )
2007-05-08 22:27:46 +01:00
[ARM] mm: fix page table initialization
As a result of the ptebits changes, we ended up marking device mappings
as normal memory on ARMv7 CPUs, resulting in undesirable behaviour with
serial ports and the like. While reviewing the section mapping table
entries, other errors in the memory type settings for devices were
detected and confirmed to prevent Xscale3 platforms booting.
Tested on:
OMAP34xx (ARMv7),
OMAP24xx (ARMv6),
OMAP16xx (ARM926T, ARMv5),
PXA311 (Xscale3),
PXA272 (Xscale),
PXA255 (Xscale),
IXP42x (Xscale),
S3C2410 (ARM920T, ARMv4T),
ARM720T (ARMv4T)
StrongARM-110 (ARMv4)
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Mike Rapoport <mike@compulab.co.il>
Tested-by: Ben Dooks <ben-linux@fluff.org>
Tested-by: Anders Grafström <grfstrm@users.sourceforge.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-11-04 10:52:28 +00:00
/ * AT
2009-05-30 14:00:16 +01:00
* TFR E V X F I D L R S
* .EEE . .EE PUI. . T . T 4 R V I Z W R S B L D P W C A M
[ARM] mm: fix page table initialization
As a result of the ptebits changes, we ended up marking device mappings
as normal memory on ARMv7 CPUs, resulting in undesirable behaviour with
serial ports and the like. While reviewing the section mapping table
entries, other errors in the memory type settings for devices were
detected and confirmed to prevent Xscale3 platforms booting.
Tested on:
OMAP34xx (ARMv7),
OMAP24xx (ARMv6),
OMAP16xx (ARM926T, ARMv5),
PXA311 (Xscale3),
PXA272 (Xscale),
PXA255 (Xscale),
IXP42x (Xscale),
S3C2410 (ARM920T, ARMv4T),
ARM720T (ARMv4T)
StrongARM-110 (ARMv4)
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Mike Rapoport <mike@compulab.co.il>
Tested-by: Ben Dooks <ben-linux@fluff.org>
Tested-by: Anders Grafström <grfstrm@users.sourceforge.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-11-04 10:52:28 +00:00
* rxxx r r x x x x x0 0 1 0 1 x x x x x x x x x11 1 x x x x < f o r c e d
2009-05-30 14:00:16 +01:00
* 1 0 1 1 0 0 0 1 1 1 1 0 0 .111 1101 < we w a n t
2007-05-08 22:27:46 +01:00
* /
2007-07-20 11:43:02 +01:00
.type v7 _ c r v a l , #o b j e c t
v7_crval :
2009-05-30 14:00:16 +01:00
crval c l e a r =0x0120c302 , m m u s e t =0x10c03c7d , u c s e t =0x00c01c7c
2007-05-08 22:27:46 +01:00
__v7_setup_stack :
.space 4 * 1 1 @ 11 registers
2010-10-01 15:37:05 +01:00
_ _ INITDATA
2011-06-23 17:26:19 +01:00
@ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
define_ p r o c e s s o r _ f u n c t i o n s v7 , d a b o r t =v7_early_abort , p a b o r t =v7_pabort , s u s p e n d =1
2007-05-08 22:27:46 +01:00
2010-10-01 15:37:05 +01:00
.section " .rodata "
2011-06-23 17:26:19 +01:00
string c p u _ a r c h _ n a m e , " a r m v7 "
string c p u _ e l f _ n a m e , " v7 "
2007-05-08 22:27:46 +01:00
.align
.section " .proc .info .init " , # alloc, #e x e c i n s t r
2011-05-20 14:39:28 +01:00
/ *
* Standard v7 p r o c i n f o c o n t e n t
* /
.macro __v7_proc initfunc, m m _ m m u f l a g s = 0 , i o _ m m u f l a g s = 0 , h w c a p s = 0
ALT_ S M P ( . l o n g P M D _ T Y P E _ S E C T | P M D _ S E C T _ A P _ W R I T E | P M D _ S E C T _ A P _ R E A D | \
PMD_ F L A G S _ S M P | \ m m _ m m u f l a g s )
ALT_ U P ( . l o n g P M D _ T Y P E _ S E C T | P M D _ S E C T _ A P _ W R I T E | P M D _ S E C T _ A P _ R E A D | \
PMD_ F L A G S _ U P | \ m m _ m m u f l a g s )
.long PMD_TYPE_SECT | PMD_ S E C T _ X N | P M D _ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D | \ i o _ m m u f l a g s
W( b ) \ i n i t f u n c
2010-09-17 16:42:10 +01:00
.long cpu_arch_name
.long cpu_elf_name
2011-05-20 14:39:28 +01:00
.long HWCAP_SWP | HWCAP_ 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 | \
HWCAP_ E D S P | H W C A P _ T L S | \ h w c a p s
2010-09-17 16:42:10 +01:00
.long cpu_v7_name
.long v7_processor_functions
.long v7wbi_tlb_fns
.long v6_user_fns
.long v7_cache_fns
2011-05-20 14:39:28 +01:00
.endm
2011-05-20 14:39:29 +01:00
/ *
* ARM L t d . C o r t e x A 5 p r o c e s s o r .
* /
.type _ _ v7 _ c a5 m p _ p r o c _ i n f o , #o b j e c t
__v7_ca5mp_proc_info :
.long 0x410fc050
.long 0xff0ffff0
_ _ v7 _ p r o c _ _ v7 _ c a5 m p _ s e t u p
.size _ _ v7 _ c a5 m p _ p r o c _ i n f o , . - _ _ v7 _ c a5 m p _ p r o c _ i n f o
2011-05-20 14:39:28 +01:00
/ *
* ARM L t d . C o r t e x A 9 p r o c e s s o r .
* /
.type _ _ v7 _ c a9 m p _ p r o c _ i n f o , #o b j e c t
__v7_ca9mp_proc_info :
.long 0x410fc090
.long 0xff0ffff0
_ _ v7 _ p r o c _ _ v7 _ c a9 m p _ s e t u p
2010-09-17 16:42:10 +01:00
.size _ _ v7 _ c a9 m p _ p r o c _ i n f o , . - _ _ v7 _ c a9 m p _ p r o c _ i n f o
2011-01-12 17:10:45 +00:00
/ *
* ARM L t d . C o r t e x A 1 5 p r o c e s s o r .
* /
.type _ _ v7 _ c a15 m p _ p r o c _ i n f o , #o b j e c t
__v7_ca15mp_proc_info :
.long 0x410fc0f0
.long 0xff0ffff0
_ _ v7 _ p r o c _ _ v7 _ c a15 m p _ s e t u p , h w c a p s = H W C A P _ I D I V
.size _ _ v7 _ c a15 m p _ p r o c _ i n f o , . - _ _ v7 _ c a15 m p _ p r o c _ i n f o
2007-05-08 22:27:46 +01:00
/ *
* Match a n y A R M v7 p r o c e s s o r c o r e .
* /
.type _ _ v7 _ p r o c _ i n f o , #o b j e c t
__v7_proc_info :
.long 0x000f0000 @ Required ID value
.long 0x000f0000 @ Mask for ID
2011-05-20 14:39:28 +01:00
_ _ v7 _ p r o c _ _ v7 _ s e t u p
2007-05-08 22:27:46 +01:00
.size _ _ v7 _ p r o c _ i n f o , . - _ _ v7 _ p r o c _ i n f o