File: /usr/src/linux/include/asm-s390/sigp.h

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/atomic.h>
19     
20     /* get real cpu address from logical cpu number */
21     extern volatile int __cpu_logical_map[];
22     
23     typedef enum
24     {
25     	sigp_unassigned=0x0,
26     	sigp_sense,
27     	sigp_external_call,
28     	sigp_emergency_signal,
29     	sigp_start,
30     	sigp_stop,
31     	sigp_restart,
32     	sigp_unassigned1,
33     	sigp_unassigned2,
34     	sigp_stop_and_store_status,
35     	sigp_unassigned3,
36     	sigp_initial_cpu_reset,
37     	sigp_cpu_reset,
38     	sigp_set_prefix,
39     	sigp_store_status_at_address,
40     	sigp_store_extended_status_at_address
41     } sigp_order_code;
42     
43     typedef __u32 sigp_status_word;
44     
45     typedef enum
46     {
47             sigp_order_code_accepted=0,
48     	sigp_status_stored,
49     	sigp_busy,
50     	sigp_not_operational
51     } sigp_ccode;
52     
53     
54     /*
55      * Definitions for the external call
56      */
57     
58     /* 'Bit' signals, asynchronous */
59     typedef enum
60     {
61     	ec_schedule=0,
62             ec_restart,
63             ec_halt,
64             ec_power_off,
65             ec_ptlb,
66     	ec_bit_last
67     } ec_bit_sig;
68     
69     /* Signals which come with a parameter area, synchronous */
70     typedef enum
71     {
72             ec_callback_async,
73             ec_callback_sync
74     } ec_cmd_sig;
75     
76     /* state information for synchronous signals */
77     typedef enum
78     {
79     	ec_pending,
80     	ec_executing,
81     	ec_done
82     } ec_state;
83     
84     /* header for the queuing of signals with a parameter area */
85     typedef struct ec_ext_call
86     {
87     	ec_cmd_sig cmd;
88     	atomic_t status;
89     	struct ec_ext_call *next;
90             void (*func)(void *info);
91             void *info;
92     } ec_ext_call;
93     
94     /*
95      * Signal processor
96      */
97     extern __inline__ sigp_ccode
98     signal_processor(__u16 cpu_addr, sigp_order_code order_code)
99     {
100     	sigp_ccode ccode;
101     
102     	__asm__ __volatile__(
103     		"    sr     1,1\n"        /* parameter=0 in gpr 1 */
104     		"    sigp   1,%1,0(%2)\n"
105     		"    ipm    %0\n"
106     		"    srl    %0,28\n"
107     		: "=d" (ccode)
108     		: "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
109     		: "cc" , "memory", "1" );
110     	return ccode;
111     }
112     
113     /*
114      * Signal processor with parameter
115      */
116     extern __inline__ sigp_ccode
117     signal_processor_p(__u32 parameter,__u16 cpu_addr,sigp_order_code order_code)
118     {
119     	sigp_ccode ccode;
120     	
121     	__asm__ __volatile__(
122     		"    lr     1,%1\n"       /* parameter in gpr 1 */
123     		"    sigp   1,%2,0(%3)\n"
124     		"    ipm    %0\n"
125     		"    srl    %0,28\n"
126     		: "=d" (ccode)
127     		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
128                       "a" (order_code)
129     		: "cc" , "memory", "1" );
130     	return ccode;
131     }
132     
133     /*
134      * Signal processor with parameter and return status
135      */
136     extern __inline__ sigp_ccode
137     signal_processor_ps(__u32 *statusptr, __u32 parameter,
138     		    __u16 cpu_addr, sigp_order_code order_code)
139     {
140     	sigp_ccode ccode;
141     	
142     	__asm__ __volatile__(
143     		"    sr     2,2\n"        /* clear status so it doesn't contain rubbish if not saved. */
144     		"    lr     3,%2\n"       /* parameter in gpr 3 */
145     		"    sigp   2,%3,0(%4)\n"
146     		"    st     2,%1\n"
147     		"    ipm    %0\n"
148     		"    srl    %0,28\n"
149     		: "=d" (ccode), "=m" (*statusptr)
150     		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
151                       "a" (order_code)
152     		: "cc" , "memory", "2" , "3"
153     		);
154        return ccode;
155     }
156     
157     #endif __SIGP__
158     
159     
160