sigp.h 2.7 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 *  include/asm-s390/sigp.h
 *
 *  S390 version
 *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
 *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
 *               Martin Schwidefsky (schwidefsky@de.ibm.com)
 *               Heiko Carstens (heiko.carstens@de.ibm.com)
 *
 *  sigp.h by D.J. Barrow (c) IBM 1999
 *  contains routines / structures for signalling other S/390 processors in an
 *  SMP configuration.
 */

#ifndef __SIGP__
#define __SIGP__

18
#include <asm/system.h>
L
Linus Torvalds 已提交
19 20

/* get real cpu address from logical cpu number */
21
extern int __cpu_logical_map[];
L
Linus Torvalds 已提交
22

23 24 25 26 27 28 29 30 31
static inline int cpu_logical_map(int cpu)
{
#ifdef CONFIG_SMP
	return __cpu_logical_map[cpu];
#else
	return stap();
#endif
}

L
Linus Torvalds 已提交
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
typedef enum
{
	sigp_unassigned=0x0,
	sigp_sense,
	sigp_external_call,
	sigp_emergency_signal,
	sigp_start,
	sigp_stop,
	sigp_restart,
	sigp_unassigned1,
	sigp_unassigned2,
	sigp_stop_and_store_status,
	sigp_unassigned3,
	sigp_initial_cpu_reset,
	sigp_cpu_reset,
	sigp_set_prefix,
	sigp_store_status_at_address,
	sigp_store_extended_status_at_address
} sigp_order_code;

typedef __u32 sigp_status_word;

typedef enum
{
        sigp_order_code_accepted=0,
	sigp_status_stored,
	sigp_busy,
	sigp_not_operational
} sigp_ccode;


/*
 * Definitions for the external call
 */

/* 'Bit' signals, asynchronous */
typedef enum
{
	ec_schedule=0,
	ec_call_function,
72
	ec_call_function_single,
L
Linus Torvalds 已提交
73 74 75 76 77 78
	ec_bit_last
} ec_bit_sig;

/*
 * Signal processor
 */
79
static inline sigp_ccode
L
Linus Torvalds 已提交
80 81
signal_processor(__u16 cpu_addr, sigp_order_code order_code)
{
82
	register unsigned long reg1 asm ("1") = 0;
L
Linus Torvalds 已提交
83 84
	sigp_ccode ccode;

85 86 87 88 89
	asm volatile(
		"	sigp	%1,%2,0(%3)\n"
		"	ipm	%0\n"
		"	srl	%0,28\n"
		:	"=d"	(ccode)
90
		: "d" (reg1), "d" (cpu_logical_map(cpu_addr)),
91
		  "a" (order_code) : "cc" , "memory");
L
Linus Torvalds 已提交
92 93 94 95 96 97
	return ccode;
}

/*
 * Signal processor with parameter
 */
98
static inline sigp_ccode
99
signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
L
Linus Torvalds 已提交
100
{
101
	register unsigned int reg1 asm ("1") = parameter;
L
Linus Torvalds 已提交
102
	sigp_ccode ccode;
103 104 105 106 107

	asm volatile(
		"	sigp	%1,%2,0(%3)\n"
		"	ipm	%0\n"
		"	srl	%0,28\n"
L
Linus Torvalds 已提交
108
		: "=d" (ccode)
109
		: "d" (reg1), "d" (cpu_logical_map(cpu_addr)),
110
		  "a" (order_code) : "cc" , "memory");
L
Linus Torvalds 已提交
111 112 113 114 115 116
	return ccode;
}

/*
 * Signal processor with parameter and return status
 */
117
static inline sigp_ccode
118 119
signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
		    sigp_order_code order_code)
L
Linus Torvalds 已提交
120
{
121
	register unsigned int reg1 asm ("1") = parameter;
L
Linus Torvalds 已提交
122
	sigp_ccode ccode;
123 124 125 126 127 128

	asm volatile(
		"	sigp	%1,%2,0(%3)\n"
		"	ipm	%0\n"
		"	srl	%0,28\n"
		: "=d" (ccode), "+d" (reg1)
129
		: "d" (cpu_logical_map(cpu_addr)), "a" (order_code)
130 131 132
		: "cc" , "memory");
	*statusptr = reg1;
	return ccode;
L
Linus Torvalds 已提交
133 134 135
}

#endif /* __SIGP__ */