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 _ASMS390X_SIGP_H_ 9 #define _ASMS390X_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 uint64_t bogus_cc = SIGP_CC_NOT_OPERATIONAL; 53 int cc; 54 55 asm volatile( 56 " tmll %[bogus_cc],3\n" 57 " sigp %[reg1],%[addr],0(%[order])\n" 58 " ipm %[cc]\n" 59 " srl %[cc],28\n" 60 : [cc] "=d" (cc), [reg1] "+d" (reg1) 61 : [addr] "d" (addr), [order] "a" (order), [bogus_cc] "d" (bogus_cc) 62 : "cc"); 63 if (status) 64 *status = reg1; 65 return cc; 66 } 67 68 static inline int sigp_retry(uint16_t addr, uint8_t order, unsigned long parm, 69 uint32_t *status) 70 { 71 int cc; 72 73 do { 74 cc = sigp(addr, order, parm, status); 75 } while (cc == 2); 76 return cc; 77 } 78 79 #endif /* __ASSEMBLER__ */ 80 #endif /* _ASMS390X_SIGP_H_ */ 81