xref: /openbmc/linux/arch/mips/include/asm/sn/launch.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1*384740dcSRalf Baechle /*
2*384740dcSRalf Baechle  * This file is subject to the terms and conditions of the GNU General Public
3*384740dcSRalf Baechle  * License.  See the file "COPYING" in the main directory of this archive
4*384740dcSRalf Baechle  * for more details.
5*384740dcSRalf Baechle  *
6*384740dcSRalf Baechle  * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
7*384740dcSRalf Baechle  * Copyright (C) 2000 by Colin Ngam
8*384740dcSRalf Baechle  */
9*384740dcSRalf Baechle #ifndef _ASM_SN_LAUNCH_H
10*384740dcSRalf Baechle #define _ASM_SN_LAUNCH_H
11*384740dcSRalf Baechle 
12*384740dcSRalf Baechle #include <asm/sn/types.h>
13*384740dcSRalf Baechle #include <asm/sn/addrs.h>
14*384740dcSRalf Baechle 
15*384740dcSRalf Baechle /*
16*384740dcSRalf Baechle  * The launch data structure resides at a fixed place in each node's memory
17*384740dcSRalf Baechle  * and is used to communicate between the master processor and the slave
18*384740dcSRalf Baechle  * processors.
19*384740dcSRalf Baechle  *
20*384740dcSRalf Baechle  * The master stores launch parameters in the launch structure
21*384740dcSRalf Baechle  * corresponding to a target processor that is in a slave loop, then sends
22*384740dcSRalf Baechle  * an interrupt to the slave processor.	 The slave calls the desired
23*384740dcSRalf Baechle  * function, then returns to the slave loop.  The master may poll or wait
24*384740dcSRalf Baechle  * for the slaves to finish.
25*384740dcSRalf Baechle  *
26*384740dcSRalf Baechle  * There is an array of launch structures, one per CPU on the node.  One
27*384740dcSRalf Baechle  * interrupt level is used per local CPU.
28*384740dcSRalf Baechle  */
29*384740dcSRalf Baechle 
30*384740dcSRalf Baechle #define LAUNCH_MAGIC		0xaddbead2addbead3
31*384740dcSRalf Baechle #ifdef CONFIG_SGI_IP27
32*384740dcSRalf Baechle #define LAUNCH_SIZEOF		0x100
33*384740dcSRalf Baechle #define LAUNCH_PADSZ		0xa0
34*384740dcSRalf Baechle #endif
35*384740dcSRalf Baechle 
36*384740dcSRalf Baechle #define LAUNCH_OFF_MAGIC	0x00	/* Struct offsets for assembly	    */
37*384740dcSRalf Baechle #define LAUNCH_OFF_BUSY		0x08
38*384740dcSRalf Baechle #define LAUNCH_OFF_CALL		0x10
39*384740dcSRalf Baechle #define LAUNCH_OFF_CALLC	0x18
40*384740dcSRalf Baechle #define LAUNCH_OFF_CALLPARM	0x20
41*384740dcSRalf Baechle #define LAUNCH_OFF_STACK	0x28
42*384740dcSRalf Baechle #define LAUNCH_OFF_GP		0x30
43*384740dcSRalf Baechle #define LAUNCH_OFF_BEVUTLB	0x38
44*384740dcSRalf Baechle #define LAUNCH_OFF_BEVNORMAL	0x40
45*384740dcSRalf Baechle #define LAUNCH_OFF_BEVECC	0x48
46*384740dcSRalf Baechle 
47*384740dcSRalf Baechle #define LAUNCH_STATE_DONE	0	/* Return value of LAUNCH_POLL	    */
48*384740dcSRalf Baechle #define LAUNCH_STATE_SENT	1
49*384740dcSRalf Baechle #define LAUNCH_STATE_RECD	2
50*384740dcSRalf Baechle 
51*384740dcSRalf Baechle /*
52*384740dcSRalf Baechle  * The launch routine is called only if the complement address is correct.
53*384740dcSRalf Baechle  *
54*384740dcSRalf Baechle  * Before control is transferred to a routine, the complement address
55*384740dcSRalf Baechle  * is zeroed (invalidated) to prevent an accidental call from a spurious
56*384740dcSRalf Baechle  * interrupt.
57*384740dcSRalf Baechle  *
58*384740dcSRalf Baechle  * The slave_launch routine turns on the BUSY flag, and the slave loop
59*384740dcSRalf Baechle  * clears the BUSY flag after control is returned to it.
60*384740dcSRalf Baechle  */
61*384740dcSRalf Baechle 
62*384740dcSRalf Baechle #ifndef __ASSEMBLY__
63*384740dcSRalf Baechle 
64*384740dcSRalf Baechle typedef int launch_state_t;
65*384740dcSRalf Baechle typedef void (*launch_proc_t)(u64 call_parm);
66*384740dcSRalf Baechle 
67*384740dcSRalf Baechle typedef struct launch_s {
68*384740dcSRalf Baechle 	volatile u64		magic;	/* Magic number			    */
69*384740dcSRalf Baechle 	volatile u64		busy;	/* Slave currently active	    */
70*384740dcSRalf Baechle 	volatile launch_proc_t	call_addr;	/* Func. for slave to call  */
71*384740dcSRalf Baechle 	volatile u64		call_addr_c;	/* 1's complement of call_addr*/
72*384740dcSRalf Baechle 	volatile u64		call_parm;	/* Single parm passed to call*/
73*384740dcSRalf Baechle 	volatile void *stack_addr;	/* Stack pointer for slave function */
74*384740dcSRalf Baechle 	volatile void *gp_addr;		/* Global pointer for slave func.   */
75*384740dcSRalf Baechle 	volatile char		*bevutlb;/* Address of bev utlb ex handler   */
76*384740dcSRalf Baechle 	volatile char		*bevnormal;/*Address of bev normal ex handler */
77*384740dcSRalf Baechle 	volatile char		*bevecc;/* Address of bev cache err handler */
78*384740dcSRalf Baechle 	volatile char		pad[160];	/* Pad to LAUNCH_SIZEOF	    */
79*384740dcSRalf Baechle } launch_t;
80*384740dcSRalf Baechle 
81*384740dcSRalf Baechle /*
82*384740dcSRalf Baechle  * PROM entry points for launch routines are determined by IPxxprom/start.s
83*384740dcSRalf Baechle  */
84*384740dcSRalf Baechle 
85*384740dcSRalf Baechle #define LAUNCH_SLAVE	(*(void (*)(int nasid, int cpu, \
86*384740dcSRalf Baechle 				    launch_proc_t call_addr, \
87*384740dcSRalf Baechle 				    u64 call_parm, \
88*384740dcSRalf Baechle 				    void *stack_addr, \
89*384740dcSRalf Baechle 				    void *gp_addr)) \
90*384740dcSRalf Baechle 			 IP27PROM_LAUNCHSLAVE)
91*384740dcSRalf Baechle 
92*384740dcSRalf Baechle #define LAUNCH_WAIT	(*(void (*)(int nasid, int cpu, int timeout_msec)) \
93*384740dcSRalf Baechle 			 IP27PROM_WAITSLAVE)
94*384740dcSRalf Baechle 
95*384740dcSRalf Baechle #define LAUNCH_POLL	(*(launch_state_t (*)(int nasid, int cpu)) \
96*384740dcSRalf Baechle 			 IP27PROM_POLLSLAVE)
97*384740dcSRalf Baechle 
98*384740dcSRalf Baechle #define LAUNCH_LOOP	(*(void (*)(void)) \
99*384740dcSRalf Baechle 			 IP27PROM_SLAVELOOP)
100*384740dcSRalf Baechle 
101*384740dcSRalf Baechle #define LAUNCH_FLASH	(*(void (*)(void)) \
102*384740dcSRalf Baechle 			 IP27PROM_FLASHLEDS)
103*384740dcSRalf Baechle 
104*384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */
105*384740dcSRalf Baechle 
106*384740dcSRalf Baechle #endif /* _ASM_SN_LAUNCH_H */
107