1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
29b747530SHeiko Carstens #ifndef __S390_ASM_SIGP_H
39b747530SHeiko Carstens #define __S390_ASM_SIGP_H
49b747530SHeiko Carstens
59b747530SHeiko Carstens /* SIGP order codes */
69b747530SHeiko Carstens #define SIGP_SENSE 1
79b747530SHeiko Carstens #define SIGP_EXTERNAL_CALL 2
89b747530SHeiko Carstens #define SIGP_EMERGENCY_SIGNAL 3
958bc33b2SThomas Huth #define SIGP_START 4
109b747530SHeiko Carstens #define SIGP_STOP 5
119b747530SHeiko Carstens #define SIGP_RESTART 6
129b747530SHeiko Carstens #define SIGP_STOP_AND_STORE_STATUS 9
139b747530SHeiko Carstens #define SIGP_INITIAL_CPU_RESET 11
14b8983830SDavid Hildenbrand #define SIGP_CPU_RESET 12
159b747530SHeiko Carstens #define SIGP_SET_PREFIX 13
169b747530SHeiko Carstens #define SIGP_STORE_STATUS_AT_ADDRESS 14
179b747530SHeiko Carstens #define SIGP_SET_ARCHITECTURE 18
18b13d3580SThomas Huth #define SIGP_COND_EMERGENCY_SIGNAL 19
199b747530SHeiko Carstens #define SIGP_SENSE_RUNNING 21
2010ad34bcSMartin Schwidefsky #define SIGP_SET_MULTI_THREADING 22
21a62bc073SMichael Holzheu #define SIGP_STORE_ADDITIONAL_STATUS 23
229b747530SHeiko Carstens
239b747530SHeiko Carstens /* SIGP condition codes */
249b747530SHeiko Carstens #define SIGP_CC_ORDER_CODE_ACCEPTED 0
259b747530SHeiko Carstens #define SIGP_CC_STATUS_STORED 1
269b747530SHeiko Carstens #define SIGP_CC_BUSY 2
279b747530SHeiko Carstens #define SIGP_CC_NOT_OPERATIONAL 3
289b747530SHeiko Carstens
299b747530SHeiko Carstens /* SIGP cpu status bits */
309b747530SHeiko Carstens
31bd50e8ecSDavid Hildenbrand #define SIGP_STATUS_INVALID_ORDER 0x00000002UL
329b747530SHeiko Carstens #define SIGP_STATUS_CHECK_STOP 0x00000010UL
339b747530SHeiko Carstens #define SIGP_STATUS_STOPPED 0x00000040UL
3421b26c08SCornelia Huck #define SIGP_STATUS_EXT_CALL_PENDING 0x00000080UL
359b747530SHeiko Carstens #define SIGP_STATUS_INVALID_PARAMETER 0x00000100UL
369b747530SHeiko Carstens #define SIGP_STATUS_INCORRECT_STATE 0x00000200UL
379b747530SHeiko Carstens #define SIGP_STATUS_NOT_RUNNING 0x00000400UL
389b747530SHeiko Carstens
39e7c46c66SHeiko Carstens #ifndef __ASSEMBLY__
40e7c46c66SHeiko Carstens
____pcpu_sigp(u16 addr,u8 order,unsigned long parm,u32 * status)4180a60f6eSHeiko Carstens static inline int ____pcpu_sigp(u16 addr, u8 order, unsigned long parm,
42a62bc073SMichael Holzheu u32 *status)
43e7c46c66SHeiko Carstens {
44*25130c1aSHeiko Carstens union register_pair r1 = { .odd = parm, };
45e7c46c66SHeiko Carstens int cc;
46e7c46c66SHeiko Carstens
47e7c46c66SHeiko Carstens asm volatile(
48*25130c1aSHeiko Carstens " sigp %[r1],%[addr],0(%[order])\n"
49*25130c1aSHeiko Carstens " ipm %[cc]\n"
50*25130c1aSHeiko Carstens " srl %[cc],28\n"
51*25130c1aSHeiko Carstens : [cc] "=&d" (cc), [r1] "+&d" (r1.pair)
52*25130c1aSHeiko Carstens : [addr] "d" (addr), [order] "a" (order)
53*25130c1aSHeiko Carstens : "cc");
54*25130c1aSHeiko Carstens *status = r1.even;
55e7c46c66SHeiko Carstens return cc;
56e7c46c66SHeiko Carstens }
57e7c46c66SHeiko Carstens
__pcpu_sigp(u16 addr,u8 order,unsigned long parm,u32 * status)5880a60f6eSHeiko Carstens static inline int __pcpu_sigp(u16 addr, u8 order, unsigned long parm,
5980a60f6eSHeiko Carstens u32 *status)
6080a60f6eSHeiko Carstens {
6180a60f6eSHeiko Carstens u32 _status;
6280a60f6eSHeiko Carstens int cc;
6380a60f6eSHeiko Carstens
6480a60f6eSHeiko Carstens cc = ____pcpu_sigp(addr, order, parm, &_status);
65bf10b668SHeiko Carstens if (status && cc == SIGP_CC_STATUS_STORED)
6680a60f6eSHeiko Carstens *status = _status;
6780a60f6eSHeiko Carstens return cc;
6880a60f6eSHeiko Carstens }
6980a60f6eSHeiko Carstens
70e7c46c66SHeiko Carstens #endif /* __ASSEMBLY__ */
71e7c46c66SHeiko Carstens
729b747530SHeiko Carstens #endif /* __S390_ASM_SIGP_H */
73