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