2005-04-17 02:20:36 +04:00
/ *
* linux/ a r c h / a r m / m m / p r o c - a r m 7 2 0 . S : M M U f u n c t i o n s f o r A R M 7 2 0
*
* Copyright ( C ) 2 0 0 0 S t e v e H i l l ( s j h i l l @cotw.com)
* Rob S c o t t ( r s c o t t @mtrob.fdns.net)
* Copyright ( C ) 2 0 0 0 A R M L i m i t e d , D e e p B l u e S o l u t i o n s L t d .
2006-06-28 17:10:01 +04:00
* hacked f o r n o n - p a g e d - M M b y H y o k S . C h o i , 2 0 0 4 .
2005-04-17 02:20:36 +04:00
*
* 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 a s p u b l i s h e d b y
* the 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 the License, or
* ( at 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 .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y 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
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e , S u i t e 3 3 0 , B o s t o n , M A 0 2 1 1 1 - 1 3 0 7 U S A
*
*
* These a r e t h e l o w l e v e l a s s e m b l e r f o r p e r f o r m i n g c a c h e a n d T L B
* functions o n t h e A R M 7 2 0 T . T h e A R M 7 2 0 T h a s a w r i t e t h r o u g h I D C
* cache, s o w e d o n ' t n e e d t o c l e a n i t .
*
* Changelog :
* 0 5 - 0 9 - 2 0 0 0 SJH C r e a t e d b y m o v i n g 7 2 0 s p e c i f i c f u n c t i o n s
* out o f ' p r o c - a r m 6 ,7 . S ' p e r R M K d i s c u s s i o n
* 0 7 - 2 5 - 2 0 0 0 SJH A d d e d i d l e f u n c t i o n .
* 0 8 - 2 5 - 2 0 0 0 DBS U p d a t e d f o r i n t e g r a t i o n o f A R M L t d v e r s i o n .
2006-06-28 17:10:01 +04:00
* 0 4 - 2 0 - 2 0 0 4 HSC m o d i f i e d f o r n o n - p a g e d m e m o r y m a n a g e m e n t m o d e .
2005-04-17 02:20:36 +04:00
* /
# 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 >
2005-09-09 23:08:59 +04:00
# include < a s m / a s m - o f f s e t s . h >
2008-09-07 22:15:31 +04:00
# include < a s m / h w c a p . h >
2006-03-16 17:44:36 +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 g t a b l e . h >
# include < a s m / p t r a c e . h >
2006-07-03 04:21:18 +04:00
# include " p r o c - m a c r o s . S "
2005-04-17 02:20:36 +04:00
/ *
* Function : arm7 2 0 _ p r o c _ i n i t ( v o i d )
* : arm7 2 0 _ p r o c _ f i n ( v o i d )
*
* Notes : T h i s p r o c e s s o r d o e s n o t r e q u i r e t h e s e
* /
ENTRY( c p u _ a r m 7 2 0 _ d c a c h e _ c l e a n _ a r e a )
ENTRY( c p u _ a r m 7 2 0 _ p r o c _ i n i t )
2014-06-30 19:29:12 +04:00
ret l r
2005-04-17 02:20:36 +04:00
ENTRY( c p u _ a r m 7 2 0 _ p r o c _ f i n )
mrc p15 , 0 , r0 , c1 , c0 , 0
bic r0 , r0 , #0x1000 @ ...i............
bic r0 , r0 , #0x000e @ ............wca.
mcr p15 , 0 , r0 , c1 , c0 , 0 @ disable caches
2014-06-30 19:29:12 +04:00
ret l r
2005-04-17 02:20:36 +04:00
/ *
* Function : arm7 2 0 _ p r o c _ d o _ i d l e ( v o i d )
* Params : r0 = u n u s e d
2011-03-31 05:57:33 +04:00
* Purpose : p u t t h e p r o c e s s o r i n p r o p e r i d l e m o d e
2005-04-17 02:20:36 +04:00
* /
ENTRY( c p u _ a r m 7 2 0 _ d o _ i d l e )
2014-06-30 19:29:12 +04:00
ret l r
2005-04-17 02:20:36 +04:00
/ *
* Function : arm7 2 0 _ s w i t c h _ m m ( u n s i g n e d l o n g p g d _ p h y s )
* Params : p g d _ p h y s P h y s i c a l a d d r e s s o f p a g e t a b l e
* Purpose : P e r f o r m a t a s k s w i t c h , s a v i n g t h e o l d p r o c e s s ' s t a t e a n d r e s t o r i n g
* the n e w .
* /
ENTRY( c p u _ a r m 7 2 0 _ s w i t c h _ m m )
2006-06-28 17:10:01 +04:00
# ifdef C O N F I G _ M M U
2005-04-17 02:20:36 +04:00
mov r1 , #0
mcr p15 , 0 , r1 , c7 , c7 , 0 @ invalidate cache
mcr p15 , 0 , r0 , c2 , c0 , 0 @ update page table ptr
mcr p15 , 0 , r1 , c8 , c7 , 0 @ flush TLB (v4)
2006-06-28 17:10:01 +04:00
# endif
2014-06-30 19:29:12 +04:00
ret l r
2005-04-17 02:20:36 +04:00
/ *
2006-12-13 17:34:43 +03:00
* Function : arm7 2 0 _ s e t _ p t e _ e x t ( p t e _ t * p t e p , p t e _ t p t e , u n s i g n e d i n t e x t )
2005-04-17 02:20:36 +04:00
* Params : r0 = A d d r e s s t o s e t
* : r1 = v a l u e t o s e t
* Purpose : S e t a P T E a n d f l u s h i t o u t o f a n y W B c a c h e
* /
2008-09-06 20:19:08 +04:00
.align 5
2006-12-13 17:34:43 +03:00
ENTRY( c p u _ a r m 7 2 0 _ s e t _ p t e _ e x t )
2006-06-28 17:10:01 +04:00
# ifdef C O N F I G _ M M U
2008-09-06 20:19:08 +04:00
armv3 _ s e t _ p t e _ e x t w c _ d i s a b l e =0
2006-06-28 17:10:01 +04:00
# endif
2014-06-30 19:29:12 +04:00
ret l r
2005-04-17 02:20:36 +04:00
/ *
* Function : arm7 2 0 _ r e s e t
* Params : r0 = a d d r e s s t o j u m p t o
* Notes : T h i s s e t s u p e v e r y t h i n g f o r a r e s e t
* /
2011-11-15 17:25:04 +04:00
.pushsection .idmap .text , " ax"
2005-04-17 02:20:36 +04:00
ENTRY( c p u _ a r m 7 2 0 _ r e s e t )
mov i p , #0
mcr p15 , 0 , i p , c7 , c7 , 0 @ invalidate cache
2006-06-28 17:10:01 +04:00
# ifdef C O N F I G _ M M U
2005-04-17 02:20:36 +04:00
mcr p15 , 0 , i p , c8 , c7 , 0 @ flush TLB (v4)
2006-06-28 17:10:01 +04:00
# endif
2005-04-17 02:20:36 +04:00
mrc p15 , 0 , i p , c1 , c0 , 0 @ get ctrl register
bic i p , i p , #0x000f @ ............wcam
bic i p , i p , #0x2100 @ ..v....s........
mcr p15 , 0 , i p , c1 , c0 , 0 @ ctrl register
2014-06-30 19:29:12 +04:00
ret r0
2011-11-15 17:25:04 +04:00
ENDPROC( c p u _ a r m 7 2 0 _ r e s e t )
.popsection
2005-04-17 02:20:36 +04:00
.type _ _ arm7 1 0 _ s e t u p , #f u n c t i o n
__arm710_setup :
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c7 , 0 @ invalidate caches
2006-06-28 17:10:01 +04:00
# ifdef C O N F I G _ M M U
2005-04-17 02:20:36 +04:00
mcr p15 , 0 , r0 , c8 , c7 , 0 @ flush TLB (v4)
2006-06-28 17:10:01 +04:00
# endif
2005-04-17 02:20:36 +04:00
mrc p15 , 0 , r0 , c1 , c0 @ get control register
ldr r5 , a r m 7 1 0 _ c r1 _ c l e a r
bic r0 , r0 , r5
ldr r5 , a r m 7 1 0 _ c r1 _ s e t
orr r0 , r0 , r5
2014-06-30 19:29:12 +04:00
ret l r @ __ret (head.S)
2005-04-17 02:20:36 +04:00
.size _ _ arm7 1 0 _ s e t u p , . - _ _ a r m 7 1 0 _ s e t u p
/ *
* R
* .RVI ZFRS BLDP W C A M
* . . . . 0 0 0 1 . .11 1101
*
* /
.type arm7 1 0 _ c r1 _ c l e a r , #o b j e c t
.type arm7 1 0 _ c r1 _ s e t , #o b j e c t
arm710_cr1_clear :
.word 0x0f3f
arm710_cr1_set :
.word 0x013d
.type _ _ arm7 2 0 _ s e t u p , #f u n c t i o n
__arm720_setup :
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c7 , 0 @ invalidate caches
2006-06-28 17:10:01 +04:00
# ifdef C O N F I G _ M M U
2005-04-17 02:20:36 +04:00
mcr p15 , 0 , r0 , c8 , c7 , 0 @ flush TLB (v4)
2006-06-28 17:10:01 +04:00
# endif
2006-06-29 18:09:57 +04:00
adr r5 , a r m 7 2 0 _ c r v a l
ldmia r5 , { r5 , r6 }
2005-04-17 02:20:36 +04:00
mrc p15 , 0 , r0 , c1 , c0 @ get control register
bic r0 , r0 , r5
2006-06-29 18:09:57 +04:00
orr r0 , r0 , r6
2014-06-30 19:29:12 +04:00
ret l r @ __ret (head.S)
2005-04-17 02:20:36 +04:00
.size _ _ arm7 2 0 _ s e t u p , . - _ _ a r m 7 2 0 _ s e t u p
/ *
* R
* .RVI ZFRS BLDP W C A M
* . .1 . 1 0 0 1 . .11 1101
*
* /
2006-06-29 18:09:57 +04:00
.type arm7 2 0 _ c r v a l , #o b j e c t
arm720_crval :
crval c l e a r =0x00002f3f , m m u s e t =0x0000213d , u c s e t =0x00000130
2005-04-17 02:20:36 +04:00
_ _ INITDATA
2011-06-23 20:18:56 +04: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 a r m 7 2 0 , d a b o r t =v4t_late_abort , p a b o r t =legacy_pabort
2005-04-17 02:20:36 +04:00
.section " .rodata "
2011-06-23 20:18:56 +04:00
string c p u _ a r c h _ n a m e , " a r m v4 t "
string c p u _ e l f _ n a m e , " v4 "
string c p u _ a r m 7 1 0 _ n a m e , " A R M 7 1 0 T "
string c p u _ a r m 7 2 0 _ n a m e , " A R M 7 2 0 T "
2005-04-17 02:20:36 +04:00
.align
/ *
2008-08-02 13:55:55 +04:00
* See < a s m / p r o c i n f o . h > f o r a d e f i n i t i o n o f t h i s s t r u c t u r e .
2005-04-17 02:20:36 +04:00
* /
2015-03-18 09:29:32 +03:00
.section " .proc .info .init " , # alloc
2005-04-17 02:20:36 +04:00
2011-06-23 20:18:56 +04:00
.macro arm720_proc_info name : req, c p u _ v a l : r e q , c p u _ m a s k : r e q , c p u _ n a m e : r e q , c p u _ f l u s h : r e q
.type _ _ \ name\ ( ) _ p r o c _ i n f o ,#o b j e c t
_ _ \ name\ ( ) _ p r o c _ i n f o :
.long \ cpu_ v a l
.long \ cpu_ m a s k
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_ B I T 4 | \
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_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2015-03-18 09:29:32 +03:00
initfn \ c p u _ f l u s h , _ _ \ n a m e \ ( ) _ p r o c _ i n f o @ cpu_flush
2005-04-17 02:20:36 +04:00
.long cpu_arch_name @ arch_name
.long cpu_elf_name @ elf_name
.long HWCAP_SWP | HWCAP_ H A L F | H W C A P _ T H U M B @ elf_hwcap
2011-06-23 20:18:56 +04:00
.long \ cpu_ n a m e
2005-04-17 02:20:36 +04:00
.long arm720_processor_functions
.long v4_tlb_fns
.long v4wt_user_fns
.long v4_cache_fns
2011-06-23 20:18:56 +04:00
.size _ _ \ name\ ( ) _ p r o c _ i n f o , . - _ _ \ n a m e \ ( ) _ p r o c _ i n f o
.endm
2005-04-17 02:20:36 +04:00
2011-06-23 20:18:56 +04:00
arm7 2 0 _ p r o c _ i n f o a r m 7 1 0 , 0 x41 8 0 7 1 0 0 , 0 x f f f f f f00 , c p u _ a r m 7 1 0 _ n a m e , _ _ a r m 7 1 0 _ s e t u p
arm7 2 0 _ p r o c _ i n f o a r m 7 2 0 , 0 x41 8 0 7 2 0 0 , 0 x f f f f f f00 , c p u _ a r m 7 2 0 _ n a m e , _ _ a r m 7 2 0 _ s e t u p