blob: ec403d4304f81c64d2fa2818187ba9731ef49944 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 * Heiko Carstens (heiko.carstens@de.ibm.com)
9 *
10 * sigp.h by D.J. Barrow (c) IBM 1999
11 * contains routines / structures for signalling other S/390 processors in an
12 * SMP configuration.
13 */
14
15#ifndef __SIGP__
16#define __SIGP__
17
18#include <asm/ptrace.h>
19#include <asm/atomic.h>
20
21/* get real cpu address from logical cpu number */
22extern volatile int __cpu_logical_map[];
23
24typedef 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
44typedef __u32 sigp_status_word;
45
46typedef enum
47{
48 sigp_order_code_accepted=0,
49 sigp_status_stored,
50 sigp_busy,
51 sigp_not_operational
52} sigp_ccode;
53
54
55/*
56 * Definitions for the external call
57 */
58
59/* 'Bit' signals, asynchronous */
60typedef enum
61{
62 ec_schedule=0,
63 ec_call_function,
Heiko Carstensca9fc752008-12-25 13:38:39 +010064 ec_call_function_single,
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 ec_bit_last
66} ec_bit_sig;
67
68/*
69 * Signal processor
70 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -080071static inline sigp_ccode
Linus Torvalds1da177e2005-04-16 15:20:36 -070072signal_processor(__u16 cpu_addr, sigp_order_code order_code)
73{
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020074 register unsigned long reg1 asm ("1") = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 sigp_ccode ccode;
76
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020077 asm volatile(
78 " sigp %1,%2,0(%3)\n"
79 " ipm %0\n"
80 " srl %0,28\n"
81 : "=d" (ccode)
82 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
83 "a" (order_code) : "cc" , "memory");
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 return ccode;
85}
86
87/*
88 * Signal processor with parameter
89 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -080090static inline sigp_ccode
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020091signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
Linus Torvalds1da177e2005-04-16 15:20:36 -070092{
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020093 register unsigned int reg1 asm ("1") = parameter;
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 sigp_ccode ccode;
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020095
96 asm volatile(
97 " sigp %1,%2,0(%3)\n"
98 " ipm %0\n"
99 " srl %0,28\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 : "=d" (ccode)
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200101 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
102 "a" (order_code) : "cc" , "memory");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 return ccode;
104}
105
106/*
107 * Signal processor with parameter and return status
108 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -0800109static inline sigp_ccode
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200110signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
111 sigp_order_code order_code)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112{
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200113 register unsigned int reg1 asm ("1") = parameter;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 sigp_ccode ccode;
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200115
116 asm volatile(
117 " sigp %1,%2,0(%3)\n"
118 " ipm %0\n"
119 " srl %0,28\n"
120 : "=d" (ccode), "+d" (reg1)
121 : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
122 : "cc" , "memory");
123 *statusptr = reg1;
124 return ccode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125}
126
127#endif /* __SIGP__ */