xref: /kvm-unit-tests/lib/s390x/asm/sigp.h (revision 0af4b381856eb3e82bcfeac5a2fef73828537a7b)
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 static inline void sigp_stop(void)
50 {
51 	register unsigned long status asm ("1") = 0;
52 	register unsigned long cpu asm ("2") = 0;
53 
54 	asm volatile(
55 		"	sigp %0,%1,0(%2)\n"
56 		: "+d" (status)  : "d" (cpu), "d" (SIGP_STOP) : "cc");
57 }
58 
59 #endif /* __ASSEMBLER__ */
60 #endif /* ASM_S390X_SIGP_H */
61