1 /*
2 * include/asm-s390/sigp.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 *
9 * sigp.h by D.J. Barrow (c) IBM 1999
10 * contains routines / structures for signalling other S/390 processors in an
11 * SMP configuration.
12 */
13
14 #ifndef __SIGP__
15 #define __SIGP__
16
17 #include <asm/ptrace.h>
18 #include <asm/misc390.h>
19 #include <asm/atomic.h>
20
21 /* get real cpu address from logical cpu number */
22 extern volatile int __cpu_logical_map[];
23
24 typedef enum
25 {
26 sigp_unassigned=0x0,
27 sigp_sense,
28 sigp_external_call,
29 sigp_emergency_signal,
30 sigp_start,
31 sigp_stop,
32 sigp_restart,
33 sigp_unassigned1,
34 sigp_unassigned2,
35 sigp_stop_and_store_status,
36 sigp_unassigned3,
37 sigp_initial_cpu_reset,
38 sigp_cpu_reset,
39 sigp_set_prefix,
40 sigp_store_status_at_address,
41 sigp_store_extended_status_at_address
42 } sigp_order_code;
43
44 #if 0
45 /*
46 * these definitions are not used at the moment, but we might need
47 * them in future.
48 */
49 typedef struct
50 {
51 __u64 cpu_timer;
52 psw_t current_psw;
53 __u32 prefix;
54 __u32 access_regs[16];
55 __u64 float_regs[4];
56 __u32 gpr_regs[16];
57 __u32 control_regs[16];
58 } sigp_status __attribute__((packed));
59
60 typedef struct
61 {
62 __u8 unused1[216];
63 __u64 cpu_timer;
64 psw_t current_psw;
65 __u32 prefix;
66 __u32 access_regs[16];
67 __u64 float_regs[4];
68 __u32 gpr_regs[16];
69 __u32 control_regs[16];
70 } sigp_status_512 __attribute__((packed));
71
72 typedef struct
73 {
74 __u32 extended_save_area_address;
75 __u64 cpu_timer;
76 psw_t current_psw;
77 __u32 prefix;
78 __u32 access_regs[16];
79 __u64 float_regs[4];
80 __u32 gpr_regs[16];
81 __u32 control_regs[16];
82 } sigp_extended_status __attribute__((packed));
83
84 typedef struct
85 {
86 __u8 unused1[212];
87 __u32 extended_save_area_address;
88 __u64 cpu_timer;
89 psw_t current_psw;
90 __u32 prefix;
91 __u32 access_regs[16];
92 __u64 float_regs[4];
93 __u32 gpr_regs[16];
94 __u32 control_regs[16];
95 } sigp_extended_status_512 __attribute__((packed));
96
97 typedef struct
98 {
99 __u64 bfp_float_regs[16];
100 __u32 bfp_float_control_reg;
101 __u8 reserved[12];
102 } sigp_extended_save_area __attribute__ ((packed));
103
104 typedef struct
105 {
106 unsigned equipment_check:1;
107 unsigned unassigned1:20;
108 unsigned incorrect_state:1;
109 unsigned invalid_parameter:1;
110 unsigned external_call_pending:1;
111 unsigned stopped:1;
112 unsigned operator_intervening:1;
113 unsigned check_stop:1;
114 unsigned unassigned2:1;
115 unsigned inoperative:1;
116 unsigned invalid_order:1;
117 unsigned receiver_check:1;
118 } sigp_status_bits __attribute__((packed));
119 #endif
120
121 typedef __u32 sigp_status_word;
122
123 typedef enum
124 {
125 sigp_order_code_accepted=0,
126 sigp_status_stored,
127 sigp_busy,
128 sigp_not_operational
129 } sigp_ccode;
130
131
132 /*
133 * Definitions for the external call
134 */
135
136 /* 'Bit' signals, asynchronous */
137 typedef enum
138 {
139 ec_schedule=0,
140 ec_restart,
141 ec_halt,
142 ec_power_off,
143 ec_bit_last
144 } ec_bit_sig;
145
146 /* Signals which come with a parameter area, synchronous */
147 typedef enum
148 {
149 ec_set_ctl,
150 ec_get_ctl,
151 ec_set_ctl_masked,
152 ec_cmd_last
153 } ec_cmd_sig;
154
155 /* state information for synchronous signals */
156 typedef enum
157 {
158 ec_pending,
159 ec_executing,
160 ec_done
161 } ec_state;
162
163 /* header for the queuing of signals with a parameter area */
164 typedef struct ec_ext_call
165 {
166 ec_cmd_sig cmd;
167 atomic_t status;
168 struct ec_ext_call *next;
169 void *parms;
170 } ec_ext_call;
171
172 /* parameter area for the ec_set_ctl and ec_get_ctl signal */
173 typedef struct
174 {
175 __u16 start_ctl;
176 __u16 end_ctl;
177 __u32 cregs[16];
178 } ec_creg_parms;
179
180 /* parameter area for the ec_set_ctl_masked signal */
181 typedef struct
182 {
183 __u16 start_ctl;
184 __u16 end_ctl;
185 __u32 orvals[16];
186 __u32 andvals[16];
187 } ec_creg_mask_parms;
188
189 /*
190 * Signal processor
191 */
192 extern __inline__ sigp_ccode
193 signal_processor(__u16 cpu_addr, sigp_order_code order_code)
194 {
195 sigp_ccode ccode;
196
197 __asm__ __volatile__(
198 " sr 1,1\n" /* parameter=0 in gpr 1 */
199 " sigp 1,%1,0(%2)\n"
200 " ipm %0\n"
201 " srl %0,28\n"
202 : "=d" (ccode)
203 : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
204 : "cc" , "memory", "1" );
205 return ccode;
206 }
207
208 /*
209 * Signal processor with parameter
210 */
211 extern __inline__ sigp_ccode
212 signal_processor_p(__u32 parameter,__u16 cpu_addr,sigp_order_code order_code)
213 {
214 sigp_ccode ccode;
215
216 __asm__ __volatile__(
217 " lr 1,%1\n" /* parameter in gpr 1 */
218 " sigp 1,%2,0(%3)\n"
219 " ipm %0\n"
220 " srl %0,28\n"
221 : "=d" (ccode)
222 : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
223 "a" (order_code)
224 : "cc" , "memory", "1" );
225 return ccode;
226 }
227
228 /*
229 * Signal processor with parameter and return status
230 */
231 extern __inline__ sigp_ccode
232 signal_processor_ps(__u32 *statusptr, __u32 parameter,
233 __u16 cpu_addr, sigp_order_code order_code)
234 {
235 sigp_ccode ccode;
236
237 __asm__ __volatile__(
238 " sr 2,2\n" /* clear status so it doesn't contain rubbish if not saved. */
239 " lr 3,%2\n" /* parameter in gpr 3 */
240 " sigp 2,%3,0(%4)\n"
241 " st 2,%1\n"
242 " ipm %0\n"
243 " srl %0,28\n"
244 : "=d" (ccode), "=m" (*statusptr)
245 : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
246 "a" (order_code)
247 : "cc" , "memory", "2" , "3"
248 );
249 return ccode;
250 }
251
252 #endif __SIGP__
253
254
255
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.