2009-06-12 12:26:24 +04:00
/ *
* Mini S C L P d r i v e r .
*
* Copyright I B M C o r p . 2 0 0 4 ,2 0 0 9
*
* Author( s ) : P e t e r O b e r p a r l e i t e r < P e t e r . O b e r p a r l e i t e r @de.ibm.com>,
* Heiko C a r s t e n s < h e i k o . c a r s t e n s @de.ibm.com>,
*
* /
2011-07-24 12:48:19 +04:00
# include < l i n u x / l i n k a g e . h >
2009-06-12 12:26:24 +04:00
LC_ E X T _ N E W _ P S W = 0 x58 # a d d r o f e x t i n t h a n d l e r
2010-02-27 00:37:53 +03:00
LC_ E X T _ N E W _ P S W _ 6 4 = 0 x1 b0 # a d d r o f e x t i n t h a n d l e r 64 b i t
2009-06-12 12:26:24 +04:00
LC_ E X T _ I N T _ P A R A M = 0 x80 # a d d r o f e x t i n t p a r a m e t e r
LC_ E X T _ I N T _ C O D E = 0 x86 # a d d r o f e x t i n t c o d e
2010-02-27 00:37:53 +03:00
LC_ A R _ M O D E _ I D = 0 x a3
2009-06-12 12:26:24 +04:00
#
# Subroutine w h i c h w a i t s s y n c h r o n o u s l y u n t i l e i t h e r a n e x t e r n a l i n t e r r u p t i o n
# or a t i m e o u t o c c u r s .
#
# Parameters :
# R2 = 0 f o r n o t i m e o u t , n o n - z e r o f o r t i m e o u t i n ( a p p r o x i m a t e d ) s e c o n d s
#
# Returns :
# R2 = 0 o n i n t e r r u p t , 2 o n t i m e o u t
# R3 = e x t e r n a l i n t e r r u p t i o n p a r a m e t e r i f R 2 =0
#
_sclp_wait_int :
stm % r6 ,% r15 ,2 4 ( % r15 ) # s a v e r e g i s t e r s
basr % r13 ,0 # g e t b a s e r e g i s t e r
.LbaseS1 :
ahi % r15 ,- 9 6 # c r e a t e s t a c k f r a m e
la % r8 ,L C _ E X T _ N E W _ P S W # r e g i s t e r i n t h a n d l e r
2010-02-27 00:37:53 +03:00
la % r9 ,. L e x t p s w S 1 - . L b a s e S 1 ( % r13 )
# ifdef C O N F I G _ 6 4 B I T
tm L C _ A R _ M O D E _ I D ,1
jno . L e s a1
la % r8 ,L C _ E X T _ N E W _ P S W _ 6 4 # r e g i s t e r i n t h a n d l e r 64 b i t
la % r9 ,. L e x t p s w S 1 _ 6 4 - . L b a s e S 1 ( % r13 )
.Lesa1 :
# endif
mvc . L o l d p s w S 1 - . L b a s e S 1 ( 1 6 ,% r13 ) ,0 ( % r8 )
mvc 0 ( 1 6 ,% r8 ) ,0 ( % r9 )
2009-06-12 12:26:24 +04:00
lhi % r6 ,0 x02 0 0 # c r m a s k f o r e x t i n t ( c r 0.5 4 )
ltr % r2 ,% r2
jz . L s e t c t S 1
ahi % r6 ,0 x08 0 0 # c r m a s k f o r c l o c k i n t ( c r 0.5 2 )
stck . L t i m e S 1 - . L b a s e S 1 ( % r13 ) # i n i t i a t e t i m e o u t
al % r2 ,. L t i m e S 1 - . L b a s e S 1 ( % r13 )
st % r2 ,. L t i m e S 1 - . L b a s e S 1 ( % r13 )
sckc . L t i m e S 1 - . L b a s e S 1 ( % r13 )
.LsetctS1 :
stctl % c0 ,% c0 ,. L c t l S 1 - . L b a s e S 1 ( % r13 ) # e n a b l e r e q u i r e d i n t e r r u p t s
l % r0 ,. L c t l S 1 - . L b a s e S 1 ( % r13 )
lhi % r1 ,~ ( 0 x20 0 | 0 x80 0 ) # c l e a r o l d v a l u e s
nr % r1 ,% r0
or % r1 ,% r6 # s e t n e w v a l u e
st % r1 ,. L c t l S 1 - . L b a s e S 1 ( % r13 )
lctl % c0 ,% c0 ,. L c t l S 1 - . L b a s e S 1 ( % r13 )
st % r0 ,. L c t l S 1 - . L b a s e S 1 ( % r13 )
lhi % r2 ,2 # r e t u r n c o d e f o r t i m e o u t
.LloopS1 :
lpsw . L w a i t p s w S 1 - . L b a s e S 1 ( % r13 ) # w a i t u n t i l i n t e r r u p t
.LwaitS1 :
lh % r7 ,L C _ E X T _ I N T _ C O D E
chi % r7 ,0 x10 0 4 # t i m e o u t ?
je . L t i m e o u t S 1
chi % r7 ,0 x24 0 1 # s e r v i c e i n t ?
jne . L l o o p S 1
sr % r2 ,% r2
l % r3 ,L C _ E X T _ I N T _ P A R A M
.LtimeoutS1 :
lctl % c0 ,% c0 ,. L c t l S 1 - . L b a s e S 1 ( % r13 ) # r e s t o r e i n t e r r u p t s e t t i n g
# restore o l d h a n d l e r
2010-02-27 00:37:53 +03:00
mvc 0 ( 1 6 ,% r8 ) ,. L o l d p s w S 1 - . L b a s e S 1 ( % r13 )
2009-06-12 12:26:24 +04:00
lm % r6 ,% r15 ,1 2 0 ( % r15 ) # r e s t o r e r e g i s t e r s
br % r14 # r e t u r n t o c a l l e r
.align 8
.LoldpswS1 :
2010-02-27 00:37:53 +03:00
.long 0 , 0 , 0 , 0 # old e x t i n t P S W
2009-06-12 12:26:24 +04:00
.LextpswS1 :
.long 0 x0 0 0 8 0 0 0 0 , 0 x80 0 0 0 0 0 0 + . L w a i t S 1 # P S W t o h a n d l e e x t i n t
2010-02-27 00:37:53 +03:00
# ifdef C O N F I G _ 6 4 B I T
.LextpswS1_64 :
.quad 0 x0 0 0 0 0 0 0 1 8 0 0 0 0 0 0 0 , . L w a i t S 1 # P S W t o h a n d l e e x t i n t , 64 b i t
# endif
2009-06-12 12:26:24 +04:00
.LwaitpswS1 :
.long 0 x0 1 0 a00 0 0 , 0 x00 0 0 0 0 0 0 + . L l o o p S 1 # P S W t o w a i t f o r e x t i n t
.LtimeS1 :
.quad 0 # current t i m e
.LctlS1 :
.long 0 # CT0 c o n t e n t s
#
# Subroutine t o s y n c h r o n o u s l y i s s u e a s e r v i c e c a l l .
#
# Parameters :
# R2 = c o m m a n d w o r d
# R3 = s c c b a d d r e s s
#
# Returns :
# R2 = 0 o n s u c c e s s , 1 o n f a i l u r e
# R3 = s c c b r e s p o n s e c o d e i f R 2 = 0
#
_sclp_servc :
stm % r6 ,% r15 ,2 4 ( % r15 ) # s a v e r e g i s t e r s
ahi % r15 ,- 9 6 # c r e a t e s t a c k f r a m e
lr % r6 ,% r2 # s a v e c o m m a n d w o r d
lr % r7 ,% r3 # s a v e s c c b a d d r e s s
.LretryS2 :
lhi % r2 ,1 # e r r o r r e t u r n c o d e
.insn rre,0 x b22 0 0 0 0 0 ,% r6 ,% r7 # s e r v c
brc 1 ,. L e n d S 2 # e x i t i f n o t o p e r a t i o n a l
brc 8 ,. L n o t b u s y S 2 # g o o n i f n o t b u s y
sr % r2 ,% r2 # w a i t u n t i l n o l o n g e r b u s y
bras % r14 ,_ s c l p _ w a i t _ i n t
j . L r e t r y S 2 # r e t r y
.LnotbusyS2 :
sr % r2 ,% r2 # w a i t u n t i l r e s u l t
bras % r14 ,_ s c l p _ w a i t _ i n t
sr % r2 ,% r2
lh % r3 ,6 ( % r7 )
.LendS2 :
lm % r6 ,% r15 ,1 2 0 ( % r15 ) # r e s t o r e r e g i s t e r s
br % r14
#
# Subroutine t o s e t u p t h e S C L P i n t e r f a c e .
#
# Parameters :
# R2 = 0 t o a c t i v a t e , n o n - z e r o t o d e a c t i v a t e
#
# Returns :
# R2 = 0 o n s u c c e s s , n o n - z e r o o n f a i l u r e
#
_sclp_setup :
stm % r6 ,% r15 ,2 4 ( % r15 ) # s a v e r e g i s t e r s
ahi % r15 ,- 9 6 # c r e a t e s t a c k f r a m e
basr % r13 ,0 # g e t b a s e r e g i s t e r
.LbaseS3 :
l % r6 ,. L s c c b S 0 - . L b a s e S 3 ( % r13 ) # p r e p a r e i n i t m a s k s c c b
mvc 0 ( . L i n i t e n d S 3 - . L i n i t s c c b S 3 ,% r6 ) ,. L i n i t s c c b S 3 - . L b a s e S 3 ( % r13 )
ltr % r2 ,% r2 # i n i t i a l i z a t i o n ?
jz . L d o i n i t S 3 # g o a h e a d
# clear m a s k s
xc . L i n i t m a s k S 3 - . L i n i t s c c b S 3 ( 8 ,% r6 ) ,. L i n i t m a s k S 3 - . L i n i t s c c b S 3 ( % r6 )
.LdoinitS3 :
l % r2 ,. L w r i t e m a s k S 3 - . L b a s e S 3 ( % r13 ) # g e t c o m m a n d w o r d
lr % r3 ,% r6 # g e t s c c b a d d r e s s
bras % r14 ,_ s c l p _ s e r v c # i s s u e s e r v i c e c a l l
ltr % r2 ,% r2 # s e r v c s u c c e s s f u l ?
jnz . L e r r o r S 3
chi % r3 ,0 x20 # w r i t e m a s k s u c c e s s f u l ?
jne . L e r r o r S 3
# check m a s k s
la % r2 ,. L i n i t m a s k S 3 - . L i n i t s c c b S 3 ( % r6 )
l % r1 ,0 ( % r2 ) # r e c e i v e m a s k o k ?
n % r1 ,1 2 ( % r2 )
cl % r1 ,0 ( % r2 )
jne . L e r r o r S 3
l % r1 ,4 ( % r2 ) # s e n d m a s k o k ?
n % r1 ,8 ( % r2 )
cl % r1 ,4 ( % r2 )
sr % r2 ,% r2
je . L e n d S 3
.LerrorS3 :
lhi % r2 ,1 # e r r o r r e t u r n c o d e
.LendS3 :
lm % r6 ,% r15 ,1 2 0 ( % r15 ) # r e s t o r e r e g i s t e r s
br % r14
.LwritemaskS3 :
.long 0x00780005 # SCLP c o m m a n d f o r w r i t e m a s k
.LinitsccbS3 :
.word .LinitendS3 - .LinitsccbS3
.byte 0 , 0 , 0 , 0
.word 0
.word 0
.word 4
.LinitmaskS3 :
.long 0x80000000
.long 0x40000000
.long 0
.long 0
.LinitendS3 :
#
# Subroutine w h i c h p r i n t s a g i v e n t e x t t o t h e S C L P c o n s o l e .
#
# Parameters :
# R2 = a d d r e s s o f n i l - t e r m i n a t e d A S C I I t e x t
#
# Returns :
# R2 = 0 o n s u c c e s s , 1 o n f a i l u r e
#
_sclp_print :
stm % r6 ,% r15 ,2 4 ( % r15 ) # s a v e r e g i s t e r s
ahi % r15 ,- 9 6 # c r e a t e s t a c k f r a m e
basr % r13 ,0 # g e t b a s e r e g i s t e r
.LbaseS4 :
l % r8 ,. L s c c b S 0 - . L b a s e S 4 ( % r13 ) # p r e p a r e w r i t e d a t a s c c b
mvc 0 ( . L m t o S 4 - . L w r i t e s c c b S 4 ,% r8 ) ,. L w r i t e s c c b S 4 - . L b a s e S 4 ( % r13 )
la % r7 ,. L m t o S 4 - . L w r i t e s c c b S 4 ( % r8 ) # c u r r e n t m t o a d d r
sr % r0 ,% r0
l % r10 ,. L a s c e b c - . L b a s e S 4 ( % r13 ) # a d d r e s s o f t r a n s l a t i o n t a b l e
.LinitmtoS4 :
# initialize m t o
mvc 0 ( . L m t o e n d S 4 - . L m t o S 4 ,% r7 ) ,. L m t o S 4 - . L b a s e S 4 ( % r13 )
lhi % r6 ,. L m t o e n d S 4 - . L m t o S 4 # c u r r e n t m t o l e n g t h
.LloopS4 :
ic % r0 ,0 ( % r2 ) # g e t c h a r a c t e r
ahi % r2 ,1
ltr % r0 ,% r0 # e n d o f s t r i n g ?
jz . L f i n a l i z e m t o S 4
chi % r0 ,0 x15 # e n d o f l i n e ( N L ) ?
jz . L f i n a l i z e m t o S 4
stc % r0 ,0 ( % r6 ,% r7 ) # c o p y t o m t o
la % r11 ,0 ( % r6 ,% r7 )
tr 0 ( 1 ,% r11 ) ,0 ( % r10 ) # t r a n s l a t e t o E B C D I C
ahi % r6 ,1
j . L l o o p S 4
.LfinalizemtoS4 :
sth % r6 ,0 ( % r7 ) # u p d a t e m t o l e n g t h
lh % r9 ,. L m d b S 4 - . L w r i t e s c c b S 4 ( % r8 ) # u p d a t e m d b l e n g t h
ar % r9 ,% r6
sth % r9 ,. L m d b S 4 - . L w r i t e s c c b S 4 ( % r8 )
lh % r9 ,. L e v b u f S 4 - . L w r i t e s c c b S 4 ( % r8 ) # u p d a t e e v b u f l e n g t h
ar % r9 ,% r6
sth % r9 ,. L e v b u f S 4 - . L w r i t e s c c b S 4 ( % r8 )
lh % r9 ,0 ( % r8 ) # u p d a t e s c c b l e n g t h
ar % r9 ,% r6
sth % r9 ,0 ( % r8 )
tree-wide: Assorted spelling fixes
In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 03:01:28 +03:00
ar % r7 ,% r6 # u p d a t e c u r r e n t m t o a d d r e s s
2009-06-12 12:26:24 +04:00
ltr % r0 ,% r0 # m o r e c h a r a c t e r s ?
jnz . L i n i t m t o S 4
l % r2 ,. L w r i t e d a t a S 4 - . L b a s e S 4 ( % r13 ) # w r i t e d a t a
lr % r3 ,% r8
bras % r14 ,_ s c l p _ s e r v c
ltr % r2 ,% r2 # s e r v c s u c c e s s f u l ?
jnz . L e n d S 4
chi % r3 ,0 x20 # w r i t e d a t a s u c c e s s f u l ?
je . L e n d S 4
lhi % r2 ,1 # e r r o r r e t u r n c o d e
.LendS4 :
lm % r6 ,% r15 ,1 2 0 ( % r15 ) # r e s t o r e r e g i s t e r s
br % r14
#
# Function w h i c h p r i n t s a g i v e n t e x t t o t h e S C L P c o n s o l e .
#
# Parameters :
# R2 = a d d r e s s o f n i l - t e r m i n a t e d A S C I I t e x t
#
# Returns :
# R2 = 0 o n s u c c e s s , 1 o n f a i l u r e
#
2011-07-24 12:48:19 +04:00
ENTRY( _ s c l p _ p r i n t _ e a r l y )
2009-06-12 12:26:24 +04:00
stm % r6 ,% r15 ,2 4 ( % r15 ) # s a v e r e g i s t e r s
ahi % r15 ,- 9 6 # c r e a t e s t a c k f r a m e
2010-02-27 00:37:53 +03:00
# ifdef C O N F I G _ 6 4 B I T
tm L C _ A R _ M O D E _ I D ,1
jno . L e s a2
ahi % r15 ,- 8 0
stmh % r6 ,% r15 ,9 6 ( % r15 ) # s t o r e u p p e r r e g i s t e r h a l v e s
.Lesa2 :
# endif
2009-06-12 12:26:24 +04:00
lr % r10 ,% r2 # s a v e s t r i n g p o i n t e r
lhi % r2 ,0
bras % r14 ,_ s c l p _ s e t u p # e n a b l e c o n s o l e
ltr % r2 ,% r2
jnz . L e n d S 5
lr % r2 ,% r10
bras % r14 ,_ s c l p _ p r i n t # p r i n t s t r i n g
ltr % r2 ,% r2
jnz . L e n d S 5
lhi % r2 ,1
bras % r14 ,_ s c l p _ s e t u p # d i s a b l e c o n s o l e
.LendS5 :
2010-02-27 00:37:53 +03:00
# ifdef C O N F I G _ 6 4 B I T
tm L C _ A R _ M O D E _ I D ,1
jno . L e s a3
lmh % r6 ,% r15 ,9 6 ( % r15 ) # s t o r e u p p e r r e g i s t e r h a l v e s
ahi % r15 ,8 0
.Lesa3 :
# endif
2009-06-12 12:26:24 +04:00
lm % r6 ,% r15 ,1 2 0 ( % r15 ) # r e s t o r e r e g i s t e r s
br % r14
.LwritedataS4 :
.long 0x00760005 # SCLP c o m m a n d f o r w r i t e d a t a
.LwritesccbS4 :
# sccb
.word .LmtoS4 - .LwritesccbS4
.byte 0
.byte 0 , 0 , 0
.word 0
# evbuf
.LevbufS4 :
.word .LmtoS4 - .LevbufS4
.byte 0x02
.byte 0
.word 0
.LmdbS4 :
# mdb
.word .LmtoS4 - .LmdbS4
.word 1
.long 0xd4c4c240
.long 1
# go
.LgoS4 :
.word .LmtoS4 - .LgoS4
.word 1
.long 0
.byte 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
.byte 0 , 0 , 0
.byte 0
.byte 0 , 0 , 0 , 0 , 0 , 0 , 0
.byte 0
.word 0
.byte 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
.byte 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
.byte 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
.LmtoS4 :
.word .LmtoendS4 - .LmtoS4
.word 4
.word 0x1000
.byte 0
.byte 0 , 0 , 0
.LmtoendS4 :
# Global c o n s t a n t s
.LsccbS0 :
.long _sclp_work_area
.Lascebc :
.long _ascebc
2009-09-23 00:58:53 +04:00
.section .data , " aw" ,@progbits
2009-06-12 12:26:24 +04:00
.balign 4096
_sclp_work_area :
.fill 4096
.previous