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