2005-04-17 02:20:36 +04:00
/ *
* linux/ d r i v e r s / a c o r n / s c s i / a c o r n s c s i - i o . S : A c o r n S C S I c a r d I O
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
2008-08-05 19:14:15 +04:00
# include < m a c h / h a r d w a r e . h >
2005-04-17 02:20:36 +04:00
2008-04-19 18:13:45 +04:00
# if d e f i n e d ( _ _ A P C S _ 3 2 _ _ )
# define L O A D R E G S ( t ,r ,l . . . ) l d m ## t r , l
# elif d e f i n e d ( _ _ A P C S _ 2 6 _ _ )
# define L O A D R E G S ( t ,r ,l . . . ) l d m ## t r , l # # ^
# endif
2005-04-17 02:20:36 +04:00
@ Purpose: transfer a block of data from the acorn scsi card to memory
@ Proto : void acornscsi_in(unsigned int addr_start, char *buffer, int length)
@ Returns: nothing
.align
ENTRY( _ _ a c o r n s c s i _ i n )
stmfd s p ! , { r4 - r7 , l r }
bic r0 , r0 , #3
mov l r , #0xff
orr l r , l r , #0xff00
acornscsi_in16lp :
subs r2 , r2 , #16
bmi a c o r n s c s i _ i n 8
ldmia r0 ! , { r3 , r4 , r5 , r6 }
and r3 , r3 , l r
orr r3 , r3 , r4 , l s l #16
and r4 , r5 , l r
orr r4 , r4 , r6 , l s l #16
ldmia r0 ! , { r5 , r6 , r7 , i p }
and r5 , r5 , l r
orr r5 , r5 , r6 , l s l #16
and r6 , r7 , l r
orr r6 , r6 , i p , l s l #16
stmia r1 ! , { r3 - r6 }
bne a c o r n s c s i _ i n 1 6 l p
LOADREGS( f d , s p ! , { r4 - r7 , p c } )
acornscsi_in8 : adds r2 , r2 , #8
bmi a c o r n s c s i _ i n 4
ldmia r0 ! , { r3 , r4 , r5 , r6 }
and r3 , r3 , l r
orr r3 , r3 , r4 , l s l #16
and r4 , r5 , l r
orr r4 , r4 , r6 , l s l #16
stmia r1 ! , { r3 - r4 }
LOADREGS( e q f d , s p ! , { r4 - r7 , p c } )
sub r2 , r2 , #8
acornscsi_in4 : adds r2 , r2 , #4
bmi a c o r n s c s i _ i n 2
ldmia r0 ! , { r3 , r4 }
and r3 , r3 , l r
orr r3 , r3 , r4 , l s l #16
str r3 , [ r1 ] , #4
LOADREGS( e q f d , s p ! , { r4 - r7 , p c } )
sub r2 , r2 , #4
acornscsi_in2 : adds r2 , r2 , #2
ldr r3 , [ r0 ] , #4
and r3 , r3 , l r
strb r3 , [ r1 ] , #1
mov r3 , r3 , l s r #8
strplb r3 , [ r1 ] , #1
LOADREGS( f d , s p ! , { r4 - r7 , p c } )
@ Purpose: transfer a block of data from memory to the acorn scsi card
@ Proto : void acornscsi_in(unsigned int addr_start, char *buffer, int length)
@ Returns: nothing
ENTRY( _ _ a c o r n s c s i _ o u t )
stmfd s p ! , { r4 - r6 , l r }
bic r0 , r0 , #3
acornscsi_out16lp :
subs r2 , r2 , #16
bmi a c o r n s c s i _ o u t 8
ldmia r1 ! , { r4 , r6 , i p , l r }
mov r3 , r4 , l s l #16
orr r3 , r3 , r3 , l s r #16
mov r4 , r4 , l s r #16
orr r4 , r4 , r4 , l s l #16
mov r5 , r6 , l s l #16
orr r5 , r5 , r5 , l s r #16
mov r6 , r6 , l s r #16
orr r6 , r6 , r6 , l s l #16
stmia r0 ! , { r3 , r4 , r5 , r6 }
mov r3 , i p , l s l #16
orr r3 , r3 , r3 , l s r #16
mov r4 , i p , l s r #16
orr r4 , r4 , r4 , l s l #16
mov i p , l r , l s l #16
orr i p , i p , i p , l s r #16
mov l r , l r , l s r #16
orr l r , l r , l r , l s l #16
stmia r0 ! , { r3 , r4 , i p , l r }
bne a c o r n s c s i _ o u t 1 6 l p
LOADREGS( f d , s p ! , { r4 - r6 , p c } )
acornscsi_out8 : adds r2 , r2 , #8
bmi a c o r n s c s i _ o u t 4
ldmia r1 ! , { r4 , r6 }
mov r3 , r4 , l s l #16
orr r3 , r3 , r3 , l s r #16
mov r4 , r4 , l s r #16
orr r4 , r4 , r4 , l s l #16
mov r5 , r6 , l s l #16
orr r5 , r5 , r5 , l s r #16
mov r6 , r6 , l s r #16
orr r6 , r6 , r6 , l s l #16
stmia r0 ! , { r3 , r4 , r5 , r6 }
LOADREGS( e q f d , s p ! , { r4 - r6 , p c } )
sub r2 , r2 , #8
acornscsi_out4 : adds r2 , r2 , #4
bmi a c o r n s c s i _ o u t 2
ldr r4 , [ r1 ] , #4
mov r3 , r4 , l s l #16
orr r3 , r3 , r3 , l s r #16
mov r4 , r4 , l s r #16
orr r4 , r4 , r4 , l s l #16
stmia r0 ! , { r3 , r4 }
LOADREGS( e q f d , s p ! , { r4 - r6 , p c } )
sub r2 , r2 , #4
acornscsi_out2 : adds r2 , r2 , #2
ldr r3 , [ r1 ] , #2
strb r3 , [ r0 ] , #1
mov r3 , r3 , l s r #8
strplb r3 , [ r0 ] , #1
LOADREGS( f d , s p ! , { r4 - r6 , p c } )