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