2019-02-03 21:37:20 +01:00
/* SPDX-License-Identifier: GPL-2.0 */
/ *
* Code t h a t n e e d s t o r u n b e l o w 2 G B .
*
* Copyright I B M C o r p . 2 0 1 9
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / e r r n o . h >
# include < a s m / s i g p . h >
2019-04-12 08:57:34 +02:00
# ifdef C C _ U S I N G _ E X P O L I N E
.pushsection .dma .text .__s390_indirect_jump_r14 , " axG"
__dma__s390_indirect_jump_r14 :
larl % r1 ,0 f
ex 0 ,0 ( % r1 )
j .
0 : br % r14
.popsection
# endif
2019-02-03 21:37:20 +01:00
.section .dma .text , " ax"
/ *
* Simplified v e r s i o n o f e x p o l i n e t h u n k . T h e n o r m a l t h u n k s c a n n o t b e u s e d h e r e ,
* because t h e y m i g h t b e m o r e t h a n 2 G B a w a y , a n d n o t r e a c h a b l e b y t h e r e l a t i v e
* branch. N o c o m d a t , e x r l , e t c . o p t i m i z a t i o n s u s e d h e r e , b e c a u s e i t o n l y
* affects a f e w f u n c t i o n s t h a t a r e n o t p e r f o r m a n c e - r e l e v a n t .
* /
.macro BR_EX_DMA_r14
2019-04-12 08:57:34 +02:00
# ifdef C C _ U S I N G _ E X P O L I N E
jg _ _ d m a _ _ s39 0 _ i n d i r e c t _ j u m p _ r14
# else
br % r14
# endif
2019-02-03 21:37:20 +01:00
.endm
/ *
* int _ d i a g 1 4 _ d m a ( u n s i g n e d l o n g r x , u n s i g n e d l o n g r y 1 , u n s i g n e d l o n g s u b c o d e )
* /
ENTRY( _ d i a g 1 4 _ d m a )
lgr % r1 ,% r2
lgr % r2 ,% r3
lgr % r3 ,% r4
lhi % r5 ,- E I O
sam3 1
diag % r1 ,% r2 ,0 x14
.Ldiag14_ex :
ipm % r5
srl % r5 ,2 8
.Ldiag14_fault :
sam6 4
lgfr % r2 ,% r5
BR_ E X _ D M A _ r14
EX_ T A B L E _ D M A ( . L d i a g 1 4 _ e x , . L d i a g 1 4 _ f a u l t )
2019-01-17 10:02:22 +01:00
ENDPROC( _ d i a g 1 4 _ d m a )
2019-02-03 21:37:20 +01:00
/ *
* int _ d i a g 2 1 0 _ d m a ( s t r u c t d i a g 2 1 0 * a d d r )
* /
ENTRY( _ d i a g 2 1 0 _ d m a )
lgr % r1 ,% r2
lhi % r2 ,- 1
sam3 1
diag % r1 ,% r0 ,0 x21 0
.Ldiag210_ex :
ipm % r2
srl % r2 ,2 8
.Ldiag210_fault :
sam6 4
lgfr % r2 ,% r2
BR_ E X _ D M A _ r14
EX_ T A B L E _ D M A ( . L d i a g 2 1 0 _ e x , . L d i a g 2 1 0 _ f a u l t )
2019-01-17 10:02:22 +01:00
ENDPROC( _ d i a g 2 1 0 _ d m a )
2019-02-03 21:37:20 +01:00
/ *
* int _ d i a g 2 6 c _ d m a ( v o i d * r e q , v o i d * r e s p , e n u m d i a g 2 6 c _ s c s u b c o d e )
* /
ENTRY( _ d i a g 2 6 c _ d m a )
lghi % r5 ,- E O P N O T S U P P
sam3 1
diag % r2 ,% r4 ,0 x26 c
.Ldiag26c_ex :
sam6 4
lgfr % r2 ,% r5
BR_ E X _ D M A _ r14
EX_ T A B L E _ D M A ( . L d i a g 2 6 c _ e x , . L d i a g 2 6 c _ e x )
2019-01-17 10:02:22 +01:00
ENDPROC( _ d i a g 2 6 c _ d m a )
2019-02-03 21:37:20 +01:00
/ *
* void _ d i a g 0 c _ d m a ( s t r u c t h y p f s _ d i a g 0 c _ e n t r y * e n t r y )
* /
ENTRY( _ d i a g 0 c _ d m a )
sam3 1
diag % r2 ,% r2 ,0 x0 c
sam6 4
BR_ E X _ D M A _ r14
2019-01-17 10:02:22 +01:00
ENDPROC( _ d i a g 0 c _ d m a )
2019-02-03 21:37:20 +01:00
/ *
* void _ s w s u s p _ r e s e t _ d m a ( v o i d )
* /
ENTRY( _ s w s u s p _ r e s e t _ d m a )
larl % r1 ,r e s t a r t _ e n t r y
larl % r2 ,. L r e s t a r t _ d i a g 3 0 8 _ p s w
og % r1 ,0 ( % r2 )
stg % r1 ,0 ( % r0 )
lghi % r0 ,0
diag % r0 ,% r0 ,0 x30 8
restart_entry :
lhi % r1 ,1
sigp % r1 ,% r0 ,S I G P _ S E T _ A R C H I T E C T U R E
sam6 4
BR_ E X _ D M A _ r14
2019-01-17 10:02:22 +01:00
ENDPROC( _ s w s u s p _ r e s e t _ d m a )
2019-02-03 21:37:20 +01:00
/ *
* void _ d i a g 3 0 8 _ r e s e t _ d m a ( v o i d )
*
* Calls d i a g 3 0 8 s u b c o d e 1 a n d c o n t i n u e s e x e c u t i o n
* /
ENTRY( _ d i a g 3 0 8 _ r e s e t _ d m a )
larl % r4 ,. L c t l r e g s # S a v e c o n t r o l r e g i s t e r s
stctg % c0 ,% c15 ,0 ( % r4 )
lg % r2 ,0 ( % r4 ) # D i s a b l e l o w c o r e p r o t e c t i o n
nilh % r2 ,0 x e f f f
larl % r4 ,. L c t l r e g 0
stg % r2 ,0 ( % r4 )
lctlg % c0 ,% c0 ,0 ( % r4 )
larl % r4 ,. L f p c t l # F l o a t i n g p o i n t c o n t r o l r e g i s t e r
stfpc 0 ( % r4 )
larl % r4 ,. L p r e f i x # S a v e p r e f i x r e g i s t e r
stpx 0 ( % r4 )
larl % r4 ,. L p r e f i x _ z e r o # S e t p r e f i x r e g i s t e r t o 0
spx 0 ( % r4 )
larl % r4 ,. L c o n t i n u e _ p s w # S a v e P S W f l a g s
epsw % r2 ,% r3
stm % r2 ,% r3 ,0 ( % r4 )
larl % r4 ,r e s t a r t _ p a r t 2 # S e t u p r e s t a r t P S W a t a b s o l u t e 0
larl % r3 ,. L r e s t a r t _ d i a g 3 0 8 _ p s w
og % r4 ,0 ( % r3 ) # S a v e P S W
lghi % r3 ,0
sturg % r4 ,% r3 # U s e s t u r g , b e c a u s e o f l a r g e p a g e s
lghi % r1 ,1
lghi % r0 ,0
diag % r0 ,% r1 ,0 x30 8
restart_part2 :
lhi % r0 ,0 # L o a d r 0 w i t h z e r o
lhi % r1 ,2 # U s e m o d e 2 = E S A M E ( d u m p )
sigp % r1 ,% r0 ,S I G P _ S E T _ A R C H I T E C T U R E # S w i t c h t o E S A M E m o d e
sam6 4 # S w i t c h t o 64 b i t a d d r e s s i n g m o d e
larl % r4 ,. L c t l r e g s # R e s t o r e c o n t r o l r e g i s t e r s
lctlg % c0 ,% c15 ,0 ( % r4 )
larl % r4 ,. L f p c t l # R e s t o r e f l o a t i n g p o i n t c t l r e g i s t e r
lfpc 0 ( % r4 )
larl % r4 ,. L p r e f i x # R e s t o r e p r e f i x r e g i s t e r
spx 0 ( % r4 )
larl % r4 ,. L c o n t i n u e _ p s w # R e s t o r e P S W f l a g s
lpswe 0 ( % r4 )
.Lcontinue :
BR_ E X _ D M A _ r14
2019-01-17 10:02:22 +01:00
ENDPROC( _ d i a g 3 0 8 _ r e s e t _ d m a )
2019-02-03 21:37:20 +01:00
.section .dma .data , " aw" ,@progbits
.align 8
.Lrestart_diag308_psw :
.long 0 x0 0 0 8 0 0 0 0 ,0 x80 0 0 0 0 0 0
.align 8
.Lcontinue_psw :
.quad 0 , .Lcontinue
.align 8
.Lctlreg0 :
.quad 0
.Lctlregs :
.rept 16
.quad 0
.endr
.Lfpctl :
.long 0
.Lprefix :
.long 0
.Lprefix_zero :
.long 0