blackfin architecture
This adds support for the Analog Devices Blackfin processor architecture, and
currently supports the BF533, BF532, BF531, BF537, BF536, BF534, and BF561
(Dual Core) devices, with a variety of development platforms including those
avaliable from Analog Devices (BF533-EZKit, BF533-STAMP, BF537-STAMP,
BF561-EZKIT), and Bluetechnix! Tinyboards.
The Blackfin architecture was jointly developed by Intel and Analog Devices
Inc. (ADI) as the Micro Signal Architecture (MSA) core and introduced it in
December of 2000. Since then ADI has put this core into its Blackfin
processor family of devices. The Blackfin core has the advantages of a clean,
orthogonal,RISC-like microprocessor instruction set. It combines a dual-MAC
(Multiply/Accumulate), state-of-the-art signal processing engine and
single-instruction, multiple-data (SIMD) multimedia capabilities into a single
instruction-set architecture.
The Blackfin architecture, including the instruction set, is described by the
ADSP-BF53x/BF56x Blackfin Processor Programming Reference
http://blackfin.uclinux.org/gf/download/frsrelease/29/2549/Blackfin_PRM.pdf
The Blackfin processor is already supported by major releases of gcc, and
there are binary and source rpms/tarballs for many architectures at:
http://blackfin.uclinux.org/gf/project/toolchain/frs There is complete
documentation, including "getting started" guides available at:
http://docs.blackfin.uclinux.org/ which provides links to the sources and
patches you will need in order to set up a cross-compiling environment for
bfin-linux-uclibc
This patch, as well as the other patches (toolchain, distribution,
uClibc) are actively supported by Analog Devices Inc, at:
http://blackfin.uclinux.org/
We have tested this on LTP, and our test plan (including pass/fails) can
be found at:
http://docs.blackfin.uclinux.org/doku.php?id=testing_the_linux_kernel
[m.kozlowski@tuxland.pl: balance parenthesis in blackfin header files]
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Aubrey Li <aubrey.li@analog.com>
Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-06 14:50:22 -07:00
/ *
* File : arch/ b l a c k f i n / m a c h - c o m m o n / c p l b m g t r . S
* Based o n :
* Author : LG S o f t I n d i a
*
* Created : ?
* Description : CPLB r e p l a c e m e n t r o u t i n e f o r C P L B m i s m a t c h
*
* Modified :
* Copyright 2 0 0 4 - 2 0 0 6 A n a l o g D e v i c e s I n c .
*
* Bugs : Enter b u g s a t h t t p : / / b l a c k f i n . u c l i n u x . o r 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 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, see the file COPYING, or write
* to 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 , I n c . ,
* 5 1 Franklin S t , F i f t h F l o o r , B o s t o n , M A 0 2 1 1 0 - 1 3 0 1 U S A
* /
/ * Usage : int _ c p l b _ m g r ( i s _ d a t a _ m i s s ,i n t e n a b l e _ c a c h e )
* is_ d a t a _ m i s s = =2 = > M a r k a s D i r t y , w r i t e t o t h e c l e a n d a t a p a g e
* is_ d a t a _ m i s s = =1 = > R e p l a c e a d a t a C P L B .
* is_ d a t a _ m i s s = =0 = > R e p l a c e a n i n s t r u c t i o n C P L B .
*
* Returns :
* CPLB_ R E L O A D E D = > S u c c e s s f u l l y u p d a t e d C P L B t a b l e .
* CPLB_ N O _ U N L O C K E D = > A l l C P L B s a r e l o c k e d , s o c a n n o t b e e v i c t e d .
* This i n d i c a t e s t h a t t h e C P L B s i n t h e c o n f i g u r a t i o n
* tablei a r e b a d l y c o n f i g u r e d , a s t h i s s h o u l d n e v e r
* occur.
* CPLB_ N O _ A D D R _ M A T C H = > T h e a d d r e s s b e i n g a c c e s s e d , t h a t t r i g g e r e d t h e
* exception, i s n o t c o v e r e d b y a n y o f t h e C P L B s i n
* the c o n f i g u r a t i o n t a b l e . T h e a p p l i c a t i o n i s
* presumably m i s b e h a v i n g .
* CPLB_ P R O T _ V I O L = > T h e a d d r e s s b e i n g a c c e s s e d , t h a t t r i g g e r e d t h e
* exception, w a s n o t a f i r s t - w r i t e t o a c l e a n W r i t e
* Back D a t a p a g e , a n d s o p r e s u m a b l y i s a g e n u i n e
* violation o f t h e p a g e ' s p r o t e c t i o n a t t r i b u t e s .
* The a p p l i c a t i o n i s m i s b e h a v i n g .
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / b l a c k f i n . h >
# include < a s m / c p l b . h >
# ifdef C O N F I G _ E X C P T _ I R Q _ S Y S C _ L 1
.section .l1 .text
# else
.text
# endif
.align 2 ;
ENTRY( _ c p l b _ m g r )
[ - - SP] = ( R 7 : 4 ,P 5 : 3 ) ;
CC = R 0 = = 2 ;
IF C C J U M P . L d c p l b _ w r i t e ;
CC = R 0 = = 0 ;
IF ! C C J U M P . L d c p l b _ m i s s _ c o m p a r e ;
/ * ICPLB M i s s E x c e p t i o n . W e n e e d t o c h o o s e o n e o f t h e
* currently- i n s t a l l e d C P L B s , a n d r e p l a c e i t w i t h o n e
* from t h e c o n f i g u r a t i o n t a b l e .
* /
P4 . L = ( I C P L B _ F A U L T _ A D D R & 0 x F F F F ) ;
P4 . H = ( I C P L B _ F A U L T _ A D D R > > 1 6 ) ;
P1 = 1 6 ;
P5 . L = _ p a g e _ s i z e _ t a b l e ;
P5 . H = _ p a g e _ s i z e _ t a b l e ;
P0 . L = ( I C P L B _ D A T A 0 & 0 x F F F F ) ;
P0 . H = ( I C P L B _ D A T A 0 > > 1 6 ) ;
R4 = [ P 4 ] ; /* Get faulting address*/
R6 = 6 4 ; /* Advance past the fault address, which*/
R6 = R 6 + R 4 ; /* we'll use if we find a match*/
R3 = ( ( 1 6 < < 8 ) | 2 ) ; /* Extract mask, bits 16 and 17.*/
R5 = 0 ;
.Lisearch :
R1 = [ P 0 - 0 x10 0 ] ; /* Address for this CPLB */
R0 = [ P 0 + + ] ; /* Info for this CPLB*/
CC = B I T T S T ( R 0 ,0 ) ; /* Is the CPLB valid?*/
IF ! C C J U M P . L n o m a t c h ; /* Skip it, if not.*/
CC = R 4 < R 1 ( I U ) ; /* If fault address less than page start*/
IF C C J U M P . L n o m a t c h ; /* then skip this one.*/
R2 = E X T R A C T ( R 0 ,R 3 . L ) ( Z ) ; /* Get page size*/
P1 = R 2 ;
P1 = P 5 + ( P 1 < < 2 ) ; /* index into page-size table*/
R2 = [ P 1 ] ; /* Get the page size*/
R1 = R 1 + R 2 ; /* and add to page start, to get page end*/
CC = R 4 < R 1 ( I U ) ; /* and see whether fault addr is in page.*/
IF ! C C R 4 = R 6 ; /* If so, advance the address and finish loop.*/
IF ! C C J U M P . L i s e a r c h _ d o n e ;
.Lnomatch :
/* Go around again*/
R5 + = 1 ;
CC = B I T T S T ( R 5 , 4 ) ; /* i.e CC = R5 >= 16*/
IF ! C C J U M P . L i s e a r c h ;
.Lisearch_done :
I0 = R 4 ; /* Fault address we'll search for*/
/* set up pointers */
P0 . L = ( I C P L B _ D A T A 0 & 0 x F F F F ) ;
P0 . H = ( I C P L B _ D A T A 0 > > 1 6 ) ;
/* The replacement procedure for ICPLBs */
P4 . L = ( I M E M _ C O N T R O L & 0 x F F F F ) ;
P4 . H = ( I M E M _ C O N T R O L > > 1 6 ) ;
/* disable cplbs */
R5 = [ P 4 ] ; /* Control Register*/
BITCLR( R 5 ,E N I C P L B _ P ) ;
CLI R 1 ;
SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
.align 8 ;
[ P4 ] = R 5 ;
SSYNC;
STI R 1 ;
R1 = - 1 ; /* end point comparison */
R3 = 1 6 ; /* counter */
/* Search through CPLBs for first non-locked entry */
/* Overwrite it by moving everyone else up by 1 */
.Licheck_lock :
R0 = [ P 0 + + ] ;
R3 = R 3 + R 1 ;
CC = R 3 = = R 1 ;
IF C C J U M P . L a l l _ l o c k e d ;
CC = B I T T S T ( R 0 , 0 ) ; /* an invalid entry is good */
IF ! C C J U M P . L i f o u n d _ v i c t i m ;
CC = B I T T S T ( R 0 ,1 ) ; /* but a locked entry isn't */
IF C C J U M P . L i c h e c k _ l o c k ;
.Lifound_victim :
# ifdef C O N F I G _ C P L B _ I N F O
R7 = [ P 0 - 0 x10 4 ] ;
P2 . L = _ i p d t _ t a b l e ;
P2 . H = _ i p d t _ t a b l e ;
P3 . L = _ i p d t _ s w a p c o u n t _ t a b l e ;
P3 . H = _ i p d t _ s w a p c o u n t _ t a b l e ;
P3 + = - 4 ;
.Licount :
R2 = [ P 2 ] ; /* address from config table */
P2 + = 8 ;
P3 + = 8 ;
CC = R 2 = = - 1 ;
IF C C J U M P . L i c o u n t _ d o n e ;
CC = R 7 = =R2 ;
IF ! C C J U M P . L i c o u n t ;
R7 = [ P 3 ] ;
R7 + = 1 ;
[ P3 ] = R 7 ;
CSYNC;
.Licount_done :
# endif
LC0 =R3 ;
LSETUP( . L i s _ m o v e ,. L i e _ m o v e ) L C 0 ;
.Lis_move :
R0 = [ P 0 ] ;
[ P0 - 4 ] = R 0 ;
R0 = [ P 0 - 0 x10 0 ] ;
[ P0 - 0 x10 4 ] = R 0 ;
.Lie_move : P0 + =4 ;
/ * We' v e m a d e s p a c e i n t h e I C P L B t a b l e , s o t h a t I C P L B 1 5
* is n o w f r e e t o b e o v e r w r i t t e n . N e x t , w e h a v e t o d e t e r m i n e
* which C P L B w e n e e d t o i n s t a l l , f r o m t h e c o n f i g u r a t i o n
* table. T h i s i s a m a t t e r o f g e t t i n g t h e s t a r t - o f - p a g e
* addresses a n d p a g e - l e n g t h s f r o m t h e c o n f i g t a b l e , a n d
* determining w h e t h e r t h e f a u l t a d d r e s s f a l l s w i t h i n t h a t
* range.
* /
P2 . L = _ i p d t _ t a b l e ;
P2 . H = _ i p d t _ t a b l e ;
# ifdef C O N F I G _ C P L B _ I N F O
P3 . L = _ i p d t _ s w a p c o u n t _ t a b l e ;
P3 . H = _ i p d t _ s w a p c o u n t _ t a b l e ;
P3 + = - 8 ;
# endif
P0 . L = _ p a g e _ s i z e _ t a b l e ;
P0 . H = _ p a g e _ s i z e _ t a b l e ;
/ * Retrieve o u r f a u l t a d d r e s s ( w h i c h m a y h a v e b e e n a d v a n c e d
* because t h e f a u l t i n g i n s t r u c t i o n c r o s s e d a p a g e b o u n d a r y ) .
* /
R0 = I 0 ;
/ * An e x t r a c t i o n p a t t e r n , t o g e t t h e p a g e - s i z e b i t s f r o m
* the C P L B d a t a e n t r y . B i t s 1 6 - 1 7 , s o t w o b i t s a t p o s n 1 6 .
* /
R1 = ( ( 1 6 < < 8 ) | 2 ) ;
.Linext : R4 = [ P 2 + + ] ; /* address from config table */
R2 = [ P 2 + + ] ; /* data from config table */
# ifdef C O N F I G _ C P L B _ I N F O
P3 + = 8 ;
# endif
CC = R 4 = = - 1 ; /* End of config table*/
IF C C J U M P . L n o _ p a g e _ i n _ t a b l e ;
/* See if failed address > start address */
CC = R 4 < = R 0 ( I U ) ;
IF ! C C J U M P . L i n e x t ;
/* extract page size (17:16)*/
R3 = E X T R A C T ( R 2 , R 1 . L ) ( Z ) ;
/* add page size to addr to get range */
P5 = R 3 ;
P5 = P 0 + ( P 5 < < 2 ) ; /* scaled, for int access*/
R3 = [ P 5 ] ;
R3 = R 3 + R 4 ;
/* See if failed address < (start address + page size) */
CC = R 0 < R 3 ( I U ) ;
IF ! C C J U M P . L i n e x t ;
/ * We' v e f o u n d a C P L B i n t h e c o n f i g t a b l e t h a t c o v e r s
* the f a u l t i n g a d d r e s s , s o i n s t a l l t h i s C P L B i n t o t h e
* last e n t r y o f t h e t a b l e .
* /
P1 . L = ( I C P L B _ D A T A 1 5 & 0 x F F F F ) ; /* ICPLB_DATA15 */
P1 . H = ( I C P L B _ D A T A 1 5 > > 1 6 ) ;
[ P1 ] = R 2 ;
[ P1 - 0 x10 0 ] = R 4 ;
# ifdef C O N F I G _ C P L B _ I N F O
R3 = [ P 3 ] ;
R3 + = 1 ;
[ P3 ] = R 3 ;
# endif
/ * P4 p o i n t s t o I M E M _ C O N T R O L , a n d R 5 c o n t a i n s i t s o l d
* value, a f t e r w e d i s a b l e d I C P L B S . R e - e n a b l e t h e m .
* /
BITSET( R 5 ,E N I C P L B _ P ) ;
CLI R 2 ;
SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
.align 8 ;
[ P4 ] = R 5 ;
SSYNC;
STI R 2 ;
( R7 : 4 , P5 : 3 ) = [ SP+ + ] ;
R0 = C P L B _ R E L O A D E D ;
RTS;
/* FAILED CASES*/
.Lno_page_in_table :
( R7 : 4 , P5 : 3 ) = [ SP+ + ] ;
R0 = C P L B _ N O _ A D D R _ M A T C H ;
RTS;
.Lall_locked :
( R7 : 4 , P5 : 3 ) = [ SP+ + ] ;
R0 = C P L B _ N O _ U N L O C K E D ;
RTS;
.Lprot_violation :
( R7 : 4 , P5 : 3 ) = [ SP+ + ] ;
R0 = C P L B _ P R O T _ V I O L ;
RTS;
.Ldcplb_write :
/ * if a D C P L B i s m a r k e d a s w r i t e - b a c k ( C P L B _ W T = =0 ) , a n d
* it i s c l e a n ( C P L B _ D I R T Y = =0 ) , t h e n a w r i t e t o t h e
* CPLB' s p a g e t r i g g e r s a p r o t e c t i o n v i o l a t i o n . W e h a v e t o
* mark t h e C P L B a s d i r t y , t o i n d i c a t e t h a t t h e r e a r e
* pending w r i t e s a s s o c i a t e d w i t h t h e C P L B .
* /
P4 . L = ( D C P L B _ S T A T U S & 0 x F F F F ) ;
P4 . H = ( D C P L B _ S T A T U S > > 1 6 ) ;
P3 . L = ( D C P L B _ D A T A 0 & 0 x F F F F ) ;
P3 . H = ( D C P L B _ D A T A 0 > > 1 6 ) ;
R5 = [ P 4 ] ;
/ * A p r o t e c t i o n v i o l a t i o n c a n b e c a u s e d b y m o r e t h a n j u s t w r i t e s
* to a c l e a n W B p a g e , s o w e h a v e t o e n s u r e t h a t :
* - It' s a w r i t e
* - to a c l e a n W B p a g e
* - and i s a l l o w e d i n t h e m o d e t h e a c c e s s o c c u r r e d .
* /
CC = B I T T S T ( R 5 , 1 6 ) ; /* ensure it was a write*/
IF ! C C J U M P . L p r o t _ v i o l a t i o n ;
/* to check the rest, we have to retrieve the DCPLB.*/
/* The low half of DCPLB_STATUS is a bit mask*/
R2 = R 5 . L ( Z ) ; /* indicating which CPLB triggered the event.*/
R3 = 3 0 ; /* so we can use this to determine the offset*/
R2 . L = S I G N B I T S R 2 ;
R2 = R 2 . L ( Z ) ; /* into the DCPLB table.*/
R3 = R 3 - R 2 ;
P4 = R 3 ;
P3 = P 3 + ( P 4 < < 2 ) ;
R3 = [ P 3 ] ; /* Retrieve the CPLB*/
/* Now we can check whether it's a clean WB page*/
CC = B I T T S T ( R 3 , 1 4 ) ; /* 0==WB, 1==WT*/
IF C C J U M P . L p r o t _ v i o l a t i o n ;
CC = B I T T S T ( R 3 , 7 ) ; /* 0 == clean, 1 == dirty*/
IF C C J U M P . L p r o t _ v i o l a t i o n ;
/* Check whether the write is allowed in the mode that was active.*/
R2 = 1 < < 3 ; /* checking write in user mode*/
CC = B I T T S T ( R 5 , 1 7 ) ; /* 0==was user, 1==was super*/
R5 = C C ;
R2 < < = R 5 ; /* if was super, check write in super mode*/
R2 = R 3 & R 2 ;
CC = R 2 = = 0 ;
IF C C J U M P . L p r o t _ v i o l a t i o n ;
/* It's a genuine write-to-clean-page.*/
BITSET( R 3 , 7 ) ; /* mark as dirty*/
[ P3 ] = R 3 ; /* and write back.*/
NOP;
CSYNC;
( R7 : 4 , P5 : 3 ) = [ SP+ + ] ;
R0 = C P L B _ R E L O A D E D ;
RTS;
.Ldcplb_miss_compare :
/ * Data C P L B M i s s e v e n t . W e n e e d t o c h o o s e a C P L B t o
* evict, a n d t h e n l o c a t e a n e w C P L B t o i n s t a l l f r o m t h e
* config t a b l e , t h a t c o v e r s t h e f a u l t i n g a d d r e s s .
* /
P1 . L = ( D C P L B _ D A T A 1 5 & 0 x F F F F ) ;
P1 . H = ( D C P L B _ D A T A 1 5 > > 1 6 ) ;
P4 . L = ( D C P L B _ F A U L T _ A D D R & 0 x F F F F ) ;
P4 . H = ( D C P L B _ F A U L T _ A D D R > > 1 6 ) ;
R4 = [ P 4 ] ;
I0 = R 4 ;
/* The replacement procedure for DCPLBs*/
R6 = R 1 ; /* Save for later*/
/* Turn off CPLBs while we work.*/
P4 . L = ( D M E M _ C O N T R O L & 0 x F F F F ) ;
P4 . H = ( D M E M _ C O N T R O L > > 1 6 ) ;
R5 = [ P 4 ] ;
BITCLR( R 5 ,E N D C P L B _ P ) ;
CLI R 0 ;
SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
.align 8 ;
[ P4 ] = R 5 ;
SSYNC;
STI R 0 ;
/ * Start l o o k i n g f o r a C P L B t o e v i c t . O u r o r d e r o f p r e f e r e n c e
* is : invalid C P L B s , c l e a n C P L B s , d i r t y C P L B s . L o c k e d C P L B s
* are n o g o o d .
* /
I1 . L = ( D C P L B _ D A T A 0 & 0 x F F F F ) ;
I1 . H = ( D C P L B _ D A T A 0 > > 1 6 ) ;
P1 = 2 ;
P2 = 1 6 ;
I2 . L = _ d c p l b _ p r e f e r e n c e ;
I2 . H = _ d c p l b _ p r e f e r e n c e ;
LSETUP( . L s d s e a r c h1 , . L e d s e a r c h1 ) L C 0 = P 1 ;
.Lsdsearch1 :
R0 = [ I 2 + + ] ; /* Get the bits we're interested in*/
P0 = I 1 ; /* Go back to start of table*/
LSETUP ( . L s d s e a r c h2 , . L e d s e a r c h2 ) L C 1 = P 2 ;
.Lsdsearch2 :
R1 = [ P 0 + + ] ; /* Fetch each installed CPLB in turn*/
R2 = R 1 & R 0 ; /* and test for interesting bits.*/
CC = R 2 = = 0 ; /* If none are set, it'll do.*/
IF ! C C J U M P . L s k i p _ s t a c k _ c h e c k ;
R2 = [ P 0 - 0 x10 4 ] ; /* R2 - PageStart */
P3 . L = _ p a g e _ s i z e _ t a b l e ; /* retrieve end address */
P3 . H = _ p a g e _ s i z e _ t a b l e ; /* retrieve end address */
R3 = 0 x10 0 2 ; /* 16th - position, 2 bits -length */
# ifdef A N O M A L Y _ 0 5 0 0 0 2 0 9
nop; /* Anomaly 05000209 */
# endif
R7 = E X T R A C T ( R 1 ,R 3 . l ) ;
R7 = R 7 < < 2 ; /* Page size index offset */
P5 = R 7 ;
P3 = P 3 + P 5 ;
R7 = [ P 3 ] ; /* page size in bytes */
R7 = R 2 + R 7 ; /* R7 - PageEnd */
R4 = S P ; /* Test SP is in range */
CC = R 7 < R 4 ; /* if PageEnd < SP */
IF C C J U M P . L d f o u n d _ v i c t i m ;
R3 = 0 x28 4 ; /* stack length from start of trap till
* the p o i n t .
* 2 0 stack l o c a t i o n s f o r f u t u r e m o d i f i c a t i o n s
* /
R4 = R 4 + R 3 ;
CC = R 4 < R 2 ; /* if SP + stacklen < PageStart */
IF C C J U M P . L d f o u n d _ v i c t i m ;
.Lskip_stack_check :
.Ledsearch2 : NOP;
.Ledsearch1 : NOP;
/ * If w e g o t h e r e , w e d i d n ' t f i n d a D C P L B w e c o n s i d e r e d
* replacable, w h i c h m e a n s a l l o f t h e m w e r e l o c k e d .
* /
JUMP . L a l l _ l o c k e d ;
.Ldfound_victim :
# ifdef C O N F I G _ C P L B _ I N F O
R7 = [ P 0 - 0 x10 4 ] ;
P2 . L = _ d p d t _ t a b l e ;
P2 . H = _ d p d t _ t a b l e ;
P3 . L = _ d p d t _ s w a p c o u n t _ t a b l e ;
P3 . H = _ d p d t _ s w a p c o u n t _ t a b l e ;
P3 + = - 4 ;
.Ldicount :
R2 = [ P 2 ] ;
P2 + = 8 ;
P3 + = 8 ;
CC = R 2 = = - 1 ;
IF C C J U M P . L d i c o u n t _ d o n e ;
CC = R 7 = =R2 ;
IF ! C C J U M P . L d i c o u n t ;
R7 = [ P 3 ] ;
R7 + = 1 ;
[ P3 ] = R 7 ;
.Ldicount_done :
# endif
/* Clean down the hardware loops*/
R2 = 0 ;
LC1 = R 2 ;
LC0 = R 2 ;
/ * There' s a s u i t a b l e v i c t i m i n [ P 0 - 4 ] ( b e c a u s e w e ' v e
* advanced a l r e a d y ) .
* /
.LDdoverwrite :
/ * [ P0 - 4 ] i s a s u i t a b l e v i c t i m C P L B , s o w e w a n t t o
* overwrite i t b y m o v i n g a l l t h e f o l l o w i n g C P L B s
* one s p a c e c l o s e r t o t h e s t a r t .
* /
R1 . L = ( D C P L B _ D A T A 1 6 & 0 x F F F F ) ; /* DCPLB_DATA15 + 4 */
R1 . H = ( D C P L B _ D A T A 1 6 > > 1 6 ) ;
R0 = P 0 ;
/ * If t h e v i c t i m h a p p e n s t o b e i n D C P L B 1 5 ,
* we d o n ' t n e e d t o m o v e a n y t h i n g .
* /
CC = R 1 = = R 0 ;
IF C C J U M P . L d e _ m o v e d ;
R1 = R 1 - R 0 ;
R1 > > = 2 ;
P1 = R 1 ;
LSETUP( . L d s _ m o v e , . L d e _ m o v e ) L C 0 =P1 ;
.Lds_move :
R0 = [ P 0 + + ] ; /* move data */
[ P0 - 8 ] = R 0 ;
R0 = [ P 0 - 0 x10 4 ] / * m o v e a d d r e s s * /
.Lde_move : [ P0 - 0 x10 8 ] = R 0 ;
/ * We' v e n o w m a d e s p a c e i n D C P L B 1 5 f o r t h e n e w C P L B t o b e
* installed. T h e n e x t s t a g e i s t o l o c a t e a C P L B i n t h e
* config t a b l e t h a t c o v e r s t h e f a u l t i n g a d d r e s s .
* /
.Lde_moved : NOP;
R0 = I 0 ; /* Our faulting address */
P2 . L = _ d p d t _ t a b l e ;
P2 . H = _ d p d t _ t a b l e ;
# ifdef C O N F I G _ C P L B _ I N F O
P3 . L = _ d p d t _ s w a p c o u n t _ t a b l e ;
P3 . H = _ d p d t _ s w a p c o u n t _ t a b l e ;
P3 + = - 8 ;
# endif
P1 . L = _ p a g e _ s i z e _ t a b l e ;
P1 . H = _ p a g e _ s i z e _ t a b l e ;
/* An extraction pattern, to retrieve bits 17:16.*/
R1 = ( 1 6 < < 8 ) | 2 ;
.Ldnext : R4 = [ P 2 + + ] ; /* address */
R2 = [ P 2 + + ] ; /* data */
# ifdef C O N F I G _ C P L B _ I N F O
P3 + = 8 ;
# endif
CC = R 4 = = - 1 ;
IF C C J U M P . L n o _ p a g e _ i n _ t a b l e ;
/* See if failed address > start address */
CC = R 4 < = R 0 ( I U ) ;
IF ! C C J U M P . L d n e x t ;
/* extract page size (17:16)*/
R3 = E X T R A C T ( R 2 , R 1 . L ) ( Z ) ;
/* add page size to addr to get range */
P5 = R 3 ;
P5 = P 1 + ( P 5 < < 2 ) ;
R3 = [ P 5 ] ;
R3 = R 3 + R 4 ;
/* See if failed address < (start address + page size) */
CC = R 0 < R 3 ( I U ) ;
IF ! C C J U M P . L d n e x t ;
/ * We' v e f o u n d t h e C P L B t h a t s h o u l d b e i n s t a l l e d , s o
* write i t i n t o C P L B 1 5 , m a s k i n g o f f a n y c a c h i n g b i t s
* if n e c e s s a r y .
* /
P1 . L = ( D C P L B _ D A T A 1 5 & 0 x F F F F ) ;
P1 . H = ( D C P L B _ D A T A 1 5 > > 1 6 ) ;
/ * If t h e D C P L B h a s c a c h e b i t s s e t , b u t c a c h i n g h a s n ' t
* been e n a b l e d , t h e n w e w a n t t o m a s k o f f t h e c a c h e - i n - L 1
* bit b e f o r e i n s t a l l i n g . M o r e o v e r , i f c a c h i n g i s o f f , w e
* also w a n t t o e n s u r e t h a t t h e D C P L B h a s W T m o d e s e t , r a t h e r
* than W B , s i n c e W B p a g e s s t i l l t r i g g e r f i r s t - w r i t e e x c e p t i o n s
* even w h e n n o t c a c h i n g i s o f f , a n d t h e p a g e i s n ' t m a r k e d a s
* cachable. F i n a l l y , w e c o u l d m a r k t h e p a g e a s c l e a n , n o t d i r t y ,
* but w e c h o o s e t o l e a v e t h a t d e c i s i o n t o t h e u s e r ; if the user
* chooses t o h a v e a C P L B p r e - d e f i n e d a s d i r t y , t h e n t h e y a l w a y s
* pay t h e c o s t o f f l u s h i n g d u r i n g e v i c t i o n , b u t d o n ' t p a y t h e
* cost o f f i r s t - w r i t e e x c e p t i o n s t o m a r k t h e p a g e a s d i r t y .
* /
# ifdef C O N F I G _ B L K F I N _ W T
BITSET( R 6 , 1 4 ) ; /* Set WT*/
# endif
[ P1 ] = R 2 ;
[ P1 - 0 x10 0 ] = R 4 ;
# ifdef C O N F I G _ C P L B _ I N F O
R3 = [ P 3 ] ;
R3 + = 1 ;
[ P3 ] = R 3 ;
# endif
/ * We' v e i n s t a l l e d t h e C P L B , s o r e - e n a b l e C P L B s . P 4
* points t o D M E M _ C O N T R O L , a n d R 5 i s t h e v a l u e w e
* last w r o t e t o i t , w h e n w e w e r e d i s a b l i n g C P L B s .
* /
BITSET( R 5 ,E N D C P L B _ P ) ;
CLI R 2 ;
.align 8 ;
[ P4 ] = R 5 ;
SSYNC;
STI R 2 ;
( R7 : 4 , P5 : 3 ) = [ SP+ + ] ;
R0 = C P L B _ R E L O A D E D ;
RTS;
2007-06-11 15:31:30 +08:00
ENDPROC( _ c p l b _ m g r )
blackfin architecture
This adds support for the Analog Devices Blackfin processor architecture, and
currently supports the BF533, BF532, BF531, BF537, BF536, BF534, and BF561
(Dual Core) devices, with a variety of development platforms including those
avaliable from Analog Devices (BF533-EZKit, BF533-STAMP, BF537-STAMP,
BF561-EZKIT), and Bluetechnix! Tinyboards.
The Blackfin architecture was jointly developed by Intel and Analog Devices
Inc. (ADI) as the Micro Signal Architecture (MSA) core and introduced it in
December of 2000. Since then ADI has put this core into its Blackfin
processor family of devices. The Blackfin core has the advantages of a clean,
orthogonal,RISC-like microprocessor instruction set. It combines a dual-MAC
(Multiply/Accumulate), state-of-the-art signal processing engine and
single-instruction, multiple-data (SIMD) multimedia capabilities into a single
instruction-set architecture.
The Blackfin architecture, including the instruction set, is described by the
ADSP-BF53x/BF56x Blackfin Processor Programming Reference
http://blackfin.uclinux.org/gf/download/frsrelease/29/2549/Blackfin_PRM.pdf
The Blackfin processor is already supported by major releases of gcc, and
there are binary and source rpms/tarballs for many architectures at:
http://blackfin.uclinux.org/gf/project/toolchain/frs There is complete
documentation, including "getting started" guides available at:
http://docs.blackfin.uclinux.org/ which provides links to the sources and
patches you will need in order to set up a cross-compiling environment for
bfin-linux-uclibc
This patch, as well as the other patches (toolchain, distribution,
uClibc) are actively supported by Analog Devices Inc, at:
http://blackfin.uclinux.org/
We have tested this on LTP, and our test plan (including pass/fails) can
be found at:
http://docs.blackfin.uclinux.org/doku.php?id=testing_the_linux_kernel
[m.kozlowski@tuxland.pl: balance parenthesis in blackfin header files]
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Aubrey Li <aubrey.li@analog.com>
Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-06 14:50:22 -07:00
.data
.align 4 ;
_page_size_table :
.byte4 0 x0 0 0 0 0 4 0 0 ; /* 1K */
.byte4 0 x0 0 0 0 1 0 0 0 ; /* 4K */
.byte4 0 x0 0 1 0 0 0 0 0 ; /* 1M */
.byte4 0 x0 0 4 0 0 0 0 0 ; /* 4M */
.align 4 ;
_dcplb_preference :
.byte4 0 x0 0 0 0 0 0 0 1 ; /* valid bit */
.byte4 0 x0 0 0 0 0 0 0 2 ; /* lock bit */