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