xref: /openbmc/linux/arch/mips/include/asm/sn/launch.h (revision 70342287)
1384740dcSRalf Baechle /*
2384740dcSRalf Baechle  * This file is subject to the terms and conditions of the GNU General Public
3384740dcSRalf Baechle  * License.  See the file "COPYING" in the main directory of this archive
4384740dcSRalf Baechle  * for more details.
5384740dcSRalf Baechle  *
6384740dcSRalf Baechle  * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
7384740dcSRalf Baechle  * Copyright (C) 2000 by Colin Ngam
8384740dcSRalf Baechle  */
9384740dcSRalf Baechle #ifndef _ASM_SN_LAUNCH_H
10384740dcSRalf Baechle #define _ASM_SN_LAUNCH_H
11384740dcSRalf Baechle 
12384740dcSRalf Baechle #include <asm/sn/types.h>
13384740dcSRalf Baechle #include <asm/sn/addrs.h>
14384740dcSRalf Baechle 
15384740dcSRalf Baechle /*
16384740dcSRalf Baechle  * The launch data structure resides at a fixed place in each node's memory
17384740dcSRalf Baechle  * and is used to communicate between the master processor and the slave
18384740dcSRalf Baechle  * processors.
19384740dcSRalf Baechle  *
20384740dcSRalf Baechle  * The master stores launch parameters in the launch structure
21384740dcSRalf Baechle  * corresponding to a target processor that is in a slave loop, then sends
22384740dcSRalf Baechle  * an interrupt to the slave processor.	 The slave calls the desired
23384740dcSRalf Baechle  * function, then returns to the slave loop.  The master may poll or wait
24384740dcSRalf Baechle  * for the slaves to finish.
25384740dcSRalf Baechle  *
26384740dcSRalf Baechle  * There is an array of launch structures, one per CPU on the node.  One
27384740dcSRalf Baechle  * interrupt level is used per local CPU.
28384740dcSRalf Baechle  */
29384740dcSRalf Baechle 
30384740dcSRalf Baechle #define LAUNCH_MAGIC		0xaddbead2addbead3
31384740dcSRalf Baechle #ifdef CONFIG_SGI_IP27
32384740dcSRalf Baechle #define LAUNCH_SIZEOF		0x100
33384740dcSRalf Baechle #define LAUNCH_PADSZ		0xa0
34384740dcSRalf Baechle #endif
35384740dcSRalf Baechle 
36384740dcSRalf Baechle #define LAUNCH_OFF_MAGIC	0x00	/* Struct offsets for assembly	    */
37384740dcSRalf Baechle #define LAUNCH_OFF_BUSY		0x08
38384740dcSRalf Baechle #define LAUNCH_OFF_CALL		0x10
39384740dcSRalf Baechle #define LAUNCH_OFF_CALLC	0x18
40384740dcSRalf Baechle #define LAUNCH_OFF_CALLPARM	0x20
41384740dcSRalf Baechle #define LAUNCH_OFF_STACK	0x28
42384740dcSRalf Baechle #define LAUNCH_OFF_GP		0x30
43384740dcSRalf Baechle #define LAUNCH_OFF_BEVUTLB	0x38
44384740dcSRalf Baechle #define LAUNCH_OFF_BEVNORMAL	0x40
45384740dcSRalf Baechle #define LAUNCH_OFF_BEVECC	0x48
46384740dcSRalf Baechle 
47384740dcSRalf Baechle #define LAUNCH_STATE_DONE	0	/* Return value of LAUNCH_POLL	    */
48384740dcSRalf Baechle #define LAUNCH_STATE_SENT	1
49384740dcSRalf Baechle #define LAUNCH_STATE_RECD	2
50384740dcSRalf Baechle 
51384740dcSRalf Baechle /*
52384740dcSRalf Baechle  * The launch routine is called only if the complement address is correct.
53384740dcSRalf Baechle  *
54384740dcSRalf Baechle  * Before control is transferred to a routine, the complement address
55384740dcSRalf Baechle  * is zeroed (invalidated) to prevent an accidental call from a spurious
56384740dcSRalf Baechle  * interrupt.
57384740dcSRalf Baechle  *
58384740dcSRalf Baechle  * The slave_launch routine turns on the BUSY flag, and the slave loop
59384740dcSRalf Baechle  * clears the BUSY flag after control is returned to it.
60384740dcSRalf Baechle  */
61384740dcSRalf Baechle 
62384740dcSRalf Baechle #ifndef __ASSEMBLY__
63384740dcSRalf Baechle 
64384740dcSRalf Baechle typedef int launch_state_t;
65384740dcSRalf Baechle typedef void (*launch_proc_t)(u64 call_parm);
66384740dcSRalf Baechle 
67384740dcSRalf Baechle typedef struct launch_s {
68384740dcSRalf Baechle 	volatile u64		magic;	/* Magic number			    */
69384740dcSRalf Baechle 	volatile u64		busy;	/* Slave currently active	    */
70384740dcSRalf Baechle 	volatile launch_proc_t	call_addr;	/* Func. for slave to call  */
71384740dcSRalf Baechle 	volatile u64		call_addr_c;	/* 1's complement of call_addr*/
72384740dcSRalf Baechle 	volatile u64		call_parm;	/* Single parm passed to call*/
73384740dcSRalf Baechle 	volatile void *stack_addr;	/* Stack pointer for slave function */
74384740dcSRalf Baechle 	volatile void *gp_addr;		/* Global pointer for slave func.   */
75384740dcSRalf Baechle 	volatile char		*bevutlb;/* Address of bev utlb ex handler   */
76384740dcSRalf Baechle 	volatile char		*bevnormal;/*Address of bev normal ex handler */
77384740dcSRalf Baechle 	volatile char		*bevecc;/* Address of bev cache err handler */
78384740dcSRalf Baechle 	volatile char		pad[160];	/* Pad to LAUNCH_SIZEOF	    */
79384740dcSRalf Baechle } launch_t;
80384740dcSRalf Baechle 
81384740dcSRalf Baechle /*
82384740dcSRalf Baechle  * PROM entry points for launch routines are determined by IPxxprom/start.s
83384740dcSRalf Baechle  */
84384740dcSRalf Baechle 
85384740dcSRalf Baechle #define LAUNCH_SLAVE	(*(void (*)(int nasid, int cpu, \
86384740dcSRalf Baechle 				    launch_proc_t call_addr, \
87384740dcSRalf Baechle 				    u64 call_parm, \
88384740dcSRalf Baechle 				    void *stack_addr, \
89384740dcSRalf Baechle 				    void *gp_addr)) \
90384740dcSRalf Baechle 			 IP27PROM_LAUNCHSLAVE)
91384740dcSRalf Baechle 
92384740dcSRalf Baechle #define LAUNCH_WAIT	(*(void (*)(int nasid, int cpu, int timeout_msec)) \
93384740dcSRalf Baechle 			 IP27PROM_WAITSLAVE)
94384740dcSRalf Baechle 
95384740dcSRalf Baechle #define LAUNCH_POLL	(*(launch_state_t (*)(int nasid, int cpu)) \
96384740dcSRalf Baechle 			 IP27PROM_POLLSLAVE)
97384740dcSRalf Baechle 
98384740dcSRalf Baechle #define LAUNCH_LOOP	(*(void (*)(void)) \
99384740dcSRalf Baechle 			 IP27PROM_SLAVELOOP)
100384740dcSRalf Baechle 
101384740dcSRalf Baechle #define LAUNCH_FLASH	(*(void (*)(void)) \
102384740dcSRalf Baechle 			 IP27PROM_FLASHLEDS)
103384740dcSRalf Baechle 
104384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */
105384740dcSRalf Baechle 
106384740dcSRalf Baechle #endif /* _ASM_SN_LAUNCH_H */
107