2019-02-03 23:37:20 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Code that needs to run below 2 GB.
|
|
|
|
*
|
|
|
|
* Copyright IBM Corp. 2019
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <asm/errno.h>
|
|
|
|
#include <asm/sigp.h>
|
|
|
|
|
2021-08-04 14:40:31 +03:00
|
|
|
.section .amode31.text,"ax"
|
2019-02-03 23:37:20 +03:00
|
|
|
/*
|
|
|
|
* Simplified version of expoline thunk. The normal thunks can not be used here,
|
|
|
|
* because they might be more than 2 GB away, and not reachable by the relative
|
|
|
|
* branch. No comdat, exrl, etc. optimizations used here, because it only
|
|
|
|
* affects a few functions that are not performance-relevant.
|
|
|
|
*/
|
2021-08-04 14:40:31 +03:00
|
|
|
.macro BR_EX_AMODE31_r14
|
2021-07-16 23:00:22 +03:00
|
|
|
larl %r1,0f
|
|
|
|
ex 0,0(%r1)
|
|
|
|
j .
|
|
|
|
0: br %r14
|
2019-02-03 23:37:20 +03:00
|
|
|
.endm
|
|
|
|
|
|
|
|
/*
|
2021-08-04 14:40:31 +03:00
|
|
|
* int _diag14_amode31(unsigned long rx, unsigned long ry1, unsigned long subcode)
|
2019-02-03 23:37:20 +03:00
|
|
|
*/
|
2021-08-04 14:40:31 +03:00
|
|
|
ENTRY(_diag14_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
lgr %r1,%r2
|
|
|
|
lgr %r2,%r3
|
|
|
|
lgr %r3,%r4
|
|
|
|
lhi %r5,-EIO
|
|
|
|
sam31
|
|
|
|
diag %r1,%r2,0x14
|
|
|
|
.Ldiag14_ex:
|
|
|
|
ipm %r5
|
|
|
|
srl %r5,28
|
|
|
|
.Ldiag14_fault:
|
|
|
|
sam64
|
|
|
|
lgfr %r2,%r5
|
2021-08-04 14:40:31 +03:00
|
|
|
BR_EX_AMODE31_r14
|
|
|
|
EX_TABLE_AMODE31(.Ldiag14_ex, .Ldiag14_fault)
|
|
|
|
ENDPROC(_diag14_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
|
|
|
|
/*
|
2021-08-04 14:40:31 +03:00
|
|
|
* int _diag210_amode31(struct diag210 *addr)
|
2019-02-03 23:37:20 +03:00
|
|
|
*/
|
2021-08-04 14:40:31 +03:00
|
|
|
ENTRY(_diag210_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
lgr %r1,%r2
|
|
|
|
lhi %r2,-1
|
|
|
|
sam31
|
|
|
|
diag %r1,%r0,0x210
|
|
|
|
.Ldiag210_ex:
|
|
|
|
ipm %r2
|
|
|
|
srl %r2,28
|
|
|
|
.Ldiag210_fault:
|
|
|
|
sam64
|
|
|
|
lgfr %r2,%r2
|
2021-08-04 14:40:31 +03:00
|
|
|
BR_EX_AMODE31_r14
|
|
|
|
EX_TABLE_AMODE31(.Ldiag210_ex, .Ldiag210_fault)
|
|
|
|
ENDPROC(_diag210_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
|
|
|
|
/*
|
2021-08-04 14:40:31 +03:00
|
|
|
* int _diag26c_amode31(void *req, void *resp, enum diag26c_sc subcode)
|
2019-02-03 23:37:20 +03:00
|
|
|
*/
|
2021-08-04 14:40:31 +03:00
|
|
|
ENTRY(_diag26c_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
lghi %r5,-EOPNOTSUPP
|
|
|
|
sam31
|
|
|
|
diag %r2,%r4,0x26c
|
|
|
|
.Ldiag26c_ex:
|
|
|
|
sam64
|
|
|
|
lgfr %r2,%r5
|
2021-08-04 14:40:31 +03:00
|
|
|
BR_EX_AMODE31_r14
|
|
|
|
EX_TABLE_AMODE31(.Ldiag26c_ex, .Ldiag26c_ex)
|
|
|
|
ENDPROC(_diag26c_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
|
|
|
|
/*
|
2021-08-04 14:40:31 +03:00
|
|
|
* void _diag0c_amode31(struct hypfs_diag0c_entry *entry)
|
2019-02-03 23:37:20 +03:00
|
|
|
*/
|
2021-08-04 14:40:31 +03:00
|
|
|
ENTRY(_diag0c_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
sam31
|
|
|
|
diag %r2,%r2,0x0c
|
|
|
|
sam64
|
2021-08-04 14:40:31 +03:00
|
|
|
BR_EX_AMODE31_r14
|
|
|
|
ENDPROC(_diag0c_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
|
|
|
|
/*
|
2021-08-04 14:40:31 +03:00
|
|
|
* void _diag308_reset_amode31(void)
|
2019-02-03 23:37:20 +03:00
|
|
|
*
|
|
|
|
* Calls diag 308 subcode 1 and continues execution
|
|
|
|
*/
|
2021-08-04 14:40:31 +03:00
|
|
|
ENTRY(_diag308_reset_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
larl %r4,.Lctlregs # Save control registers
|
|
|
|
stctg %c0,%c15,0(%r4)
|
|
|
|
lg %r2,0(%r4) # Disable lowcore protection
|
|
|
|
nilh %r2,0xefff
|
|
|
|
larl %r4,.Lctlreg0
|
|
|
|
stg %r2,0(%r4)
|
|
|
|
lctlg %c0,%c0,0(%r4)
|
|
|
|
larl %r4,.Lfpctl # Floating point control register
|
|
|
|
stfpc 0(%r4)
|
|
|
|
larl %r4,.Lprefix # Save prefix register
|
|
|
|
stpx 0(%r4)
|
|
|
|
larl %r4,.Lprefix_zero # Set prefix register to 0
|
|
|
|
spx 0(%r4)
|
|
|
|
larl %r4,.Lcontinue_psw # Save PSW flags
|
|
|
|
epsw %r2,%r3
|
|
|
|
stm %r2,%r3,0(%r4)
|
2021-08-24 18:21:12 +03:00
|
|
|
larl %r4,.Lrestart_part2 # Setup restart PSW at absolute 0
|
2019-02-03 23:37:20 +03:00
|
|
|
larl %r3,.Lrestart_diag308_psw
|
|
|
|
og %r4,0(%r3) # Save PSW
|
|
|
|
lghi %r3,0
|
|
|
|
sturg %r4,%r3 # Use sturg, because of large pages
|
|
|
|
lghi %r1,1
|
|
|
|
lghi %r0,0
|
|
|
|
diag %r0,%r1,0x308
|
2021-08-24 18:21:12 +03:00
|
|
|
.Lrestart_part2:
|
2019-02-03 23:37:20 +03:00
|
|
|
lhi %r0,0 # Load r0 with zero
|
|
|
|
lhi %r1,2 # Use mode 2 = ESAME (dump)
|
|
|
|
sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to ESAME mode
|
|
|
|
sam64 # Switch to 64 bit addressing mode
|
|
|
|
larl %r4,.Lctlregs # Restore control registers
|
|
|
|
lctlg %c0,%c15,0(%r4)
|
|
|
|
larl %r4,.Lfpctl # Restore floating point ctl register
|
|
|
|
lfpc 0(%r4)
|
|
|
|
larl %r4,.Lprefix # Restore prefix register
|
|
|
|
spx 0(%r4)
|
|
|
|
larl %r4,.Lcontinue_psw # Restore PSW flags
|
2021-06-15 17:05:09 +03:00
|
|
|
larl %r2,.Lcontinue
|
|
|
|
stg %r2,8(%r4)
|
2019-02-03 23:37:20 +03:00
|
|
|
lpswe 0(%r4)
|
|
|
|
.Lcontinue:
|
2021-08-04 14:40:31 +03:00
|
|
|
BR_EX_AMODE31_r14
|
|
|
|
ENDPROC(_diag308_reset_amode31)
|
2019-02-03 23:37:20 +03:00
|
|
|
|
2021-08-04 14:40:31 +03:00
|
|
|
.section .amode31.data,"aw",@progbits
|
2019-02-03 23:37:20 +03:00
|
|
|
.align 8
|
|
|
|
.Lrestart_diag308_psw:
|
|
|
|
.long 0x00080000,0x80000000
|
|
|
|
|
|
|
|
.align 8
|
|
|
|
.Lcontinue_psw:
|
2021-06-15 17:05:09 +03:00
|
|
|
.quad 0,0
|
2019-02-03 23:37:20 +03:00
|
|
|
|
|
|
|
.align 8
|
|
|
|
.Lctlreg0:
|
|
|
|
.quad 0
|
|
|
|
.Lctlregs:
|
|
|
|
.rept 16
|
|
|
|
.quad 0
|
|
|
|
.endr
|
|
|
|
.Lfpctl:
|
|
|
|
.long 0
|
|
|
|
.Lprefix:
|
|
|
|
.long 0
|
|
|
|
.Lprefix_zero:
|
|
|
|
.long 0
|