1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * SIGP related definitions. 4 * 5 * Copied from the Linux kernel file arch/s390/include/asm/sigp.h 6 */ 7 8 #ifndef ASM_S390X_SIGP_H 9 #define ASM_S390X_SIGP_H 10 11 /* SIGP order codes */ 12 #define SIGP_SENSE 1 13 #define SIGP_EXTERNAL_CALL 2 14 #define SIGP_EMERGENCY_SIGNAL 3 15 #define SIGP_START 4 16 #define SIGP_STOP 5 17 #define SIGP_RESTART 6 18 #define SIGP_STOP_AND_STORE_STATUS 9 19 #define SIGP_INITIAL_CPU_RESET 11 20 #define SIGP_CPU_RESET 12 21 #define SIGP_SET_PREFIX 13 22 #define SIGP_STORE_STATUS_AT_ADDRESS 14 23 #define SIGP_SET_ARCHITECTURE 18 24 #define SIGP_COND_EMERGENCY_SIGNAL 19 25 #define SIGP_SENSE_RUNNING 21 26 #define SIGP_SET_MULTI_THREADING 22 27 #define SIGP_STORE_ADDITIONAL_STATUS 23 28 29 /* SIGP condition codes */ 30 #define SIGP_CC_ORDER_CODE_ACCEPTED 0 31 #define SIGP_CC_STATUS_STORED 1 32 #define SIGP_CC_BUSY 2 33 #define SIGP_CC_NOT_OPERATIONAL 3 34 35 /* SIGP cpu status bits */ 36 37 #define SIGP_STATUS_INVALID_ORDER 0x00000002UL 38 #define SIGP_STATUS_CHECK_STOP 0x00000010UL 39 #define SIGP_STATUS_STOPPED 0x00000040UL 40 #define SIGP_STATUS_EXT_CALL_PENDING 0x00000080UL 41 #define SIGP_STATUS_INVALID_PARAMETER 0x00000100UL 42 #define SIGP_STATUS_INCORRECT_STATE 0x00000200UL 43 #define SIGP_STATUS_NOT_RUNNING 0x00000400UL 44 45 #ifndef __ASSEMBLER__ 46 47 48 static inline int sigp(uint16_t addr, uint8_t order, unsigned long parm, 49 uint32_t *status) 50 { 51 register unsigned long reg1 asm ("1") = parm; 52 int cc; 53 54 asm volatile( 55 " sigp %1,%2,0(%3)\n" 56 " ipm %0\n" 57 " srl %0,28\n" 58 : "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc"); 59 if (status) 60 *status = reg1; 61 return cc; 62 } 63 64 static inline int sigp_retry(uint16_t addr, uint8_t order, unsigned long parm, 65 uint32_t *status) 66 { 67 int cc; 68 69 do { 70 cc = sigp(addr, order, parm, status); 71 } while (cc == 2); 72 return cc; 73 } 74 75 #endif /* __ASSEMBLER__ */ 76 #endif /* ASM_S390X_SIGP_H */ 77