2005-04-16 15:20:36 -07:00
|
|
|
/*
|
2010-02-26 14:37:35 -07:00
|
|
|
* Routines and structures for signalling other processors.
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
2010-02-26 14:37:35 -07:00
|
|
|
* Copyright IBM Corp. 1999,2010
|
|
|
|
* Author(s): Denis Joseph Barrow,
|
|
|
|
* Martin Schwidefsky <schwidefsky@de.ibm.com>,
|
|
|
|
* Heiko Carstens <heiko.carstens@de.ibm.com>,
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
|
|
|
|
2010-02-26 14:37:35 -07:00
|
|
|
#ifndef __ASM_SIGP_H
|
|
|
|
#define __ASM_SIGP_H
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-01-13 12:44:37 -07:00
|
|
|
#include <asm/system.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-02-26 14:37:35 -07:00
|
|
|
/* Get real cpu address from logical cpu number. */
|
|
|
|
extern unsigned short __cpu_logical_map[];
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-01-13 12:44:37 -07:00
|
|
|
static inline int cpu_logical_map(int cpu)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
return __cpu_logical_map[cpu];
|
|
|
|
#else
|
|
|
|
return stap();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-02-26 14:37:35 -07:00
|
|
|
enum {
|
2010-02-26 14:37:40 -07:00
|
|
|
sigp_sense = 1,
|
|
|
|
sigp_external_call = 2,
|
|
|
|
sigp_emergency_signal = 3,
|
|
|
|
sigp_start = 4,
|
|
|
|
sigp_stop = 5,
|
|
|
|
sigp_restart = 6,
|
|
|
|
sigp_stop_and_store_status = 9,
|
|
|
|
sigp_initial_cpu_reset = 11,
|
|
|
|
sigp_cpu_reset = 12,
|
|
|
|
sigp_set_prefix = 13,
|
|
|
|
sigp_store_status_at_address = 14,
|
|
|
|
sigp_store_extended_status_at_address = 15,
|
|
|
|
sigp_set_architecture = 18,
|
|
|
|
sigp_conditional_emergency_signal = 19,
|
|
|
|
sigp_sense_running = 21,
|
2010-02-26 14:37:35 -07:00
|
|
|
};
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-02-26 14:37:35 -07:00
|
|
|
enum {
|
2010-02-26 14:37:40 -07:00
|
|
|
sigp_order_code_accepted = 0,
|
|
|
|
sigp_status_stored = 1,
|
|
|
|
sigp_busy = 2,
|
|
|
|
sigp_not_operational = 3,
|
2010-02-26 14:37:35 -07:00
|
|
|
};
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/*
|
2010-02-26 14:37:35 -07:00
|
|
|
* Definitions for external call.
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
2010-02-26 14:37:35 -07:00
|
|
|
enum {
|
|
|
|
ec_schedule = 0,
|
2005-04-16 15:20:36 -07:00
|
|
|
ec_call_function,
|
2008-12-25 05:38:39 -07:00
|
|
|
ec_call_function_single,
|
2010-02-26 14:37:35 -07:00
|
|
|
};
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/*
|
2010-02-26 14:37:35 -07:00
|
|
|
* Signal processor.
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
2010-02-26 14:37:35 -07:00
|
|
|
static inline int raw_sigp(u16 cpu, int order)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-09-28 07:56:43 -07:00
|
|
|
register unsigned long reg1 asm ("1") = 0;
|
2010-02-26 14:37:35 -07:00
|
|
|
int ccode;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-09-28 07:56:43 -07:00
|
|
|
asm volatile(
|
|
|
|
" sigp %1,%2,0(%3)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
|
|
|
: "=d" (ccode)
|
2010-02-26 14:37:35 -07:00
|
|
|
: "d" (reg1), "d" (cpu),
|
|
|
|
"a" (order) : "cc" , "memory");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-02-26 14:37:35 -07:00
|
|
|
* Signal processor with parameter.
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
2010-02-26 14:37:35 -07:00
|
|
|
static inline int raw_sigp_p(u32 parameter, u16 cpu, int order)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2006-09-28 07:56:43 -07:00
|
|
|
register unsigned int reg1 asm ("1") = parameter;
|
2010-02-26 14:37:35 -07:00
|
|
|
int ccode;
|
2006-09-28 07:56:43 -07:00
|
|
|
|
|
|
|
asm volatile(
|
|
|
|
" sigp %1,%2,0(%3)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
2005-04-16 15:20:36 -07:00
|
|
|
: "=d" (ccode)
|
2010-02-26 14:37:35 -07:00
|
|
|
: "d" (reg1), "d" (cpu),
|
|
|
|
"a" (order) : "cc" , "memory");
|
2005-04-16 15:20:36 -07:00
|
|
|
return ccode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-02-26 14:37:35 -07:00
|
|
|
* Signal processor with parameter and return status.
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
2010-02-26 14:37:35 -07:00
|
|
|
static inline int raw_sigp_ps(u32 *status, u32 parm, u16 cpu, int order)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2010-02-26 14:37:35 -07:00
|
|
|
register unsigned int reg1 asm ("1") = parm;
|
|
|
|
int ccode;
|
2006-09-28 07:56:43 -07:00
|
|
|
|
|
|
|
asm volatile(
|
|
|
|
" sigp %1,%2,0(%3)\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
|
|
|
: "=d" (ccode), "+d" (reg1)
|
2010-02-26 14:37:35 -07:00
|
|
|
: "d" (cpu), "a" (order)
|
2006-09-28 07:56:43 -07:00
|
|
|
: "cc" , "memory");
|
2010-02-26 14:37:35 -07:00
|
|
|
*status = reg1;
|
2006-09-28 07:56:43 -07:00
|
|
|
return ccode;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2010-02-26 14:37:35 -07:00
|
|
|
static inline int sigp(int cpu, int order)
|
|
|
|
{
|
|
|
|
return raw_sigp(cpu_logical_map(cpu), order);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int sigp_p(u32 parameter, int cpu, int order)
|
|
|
|
{
|
|
|
|
return raw_sigp_p(parameter, cpu_logical_map(cpu), order);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int sigp_ps(u32 *status, u32 parm, int cpu, int order)
|
|
|
|
{
|
|
|
|
return raw_sigp_ps(status, parm, cpu_logical_map(cpu), order);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __ASM_SIGP_H */
|