Import 2.3.16
[davej-history.git] / arch / sparc / prom / mp.c
blob2346e35640ff3dbf46eb095d58025fefe70b4341
1 /* $Id: mp.c,v 1.10 1998/03/09 14:04:26 jj Exp $
2 * mp.c: OpenBoot Prom Multiprocessor support routines. Don't call
3 * these on a UP or else you will halt and catch fire. ;)
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
12 #include <asm/openprom.h>
13 #include <asm/oplib.h>
15 extern void restore_current(void);
17 /* Start cpu with prom-tree node 'cpunode' using context described
18 * by 'ctable_reg' in context 'ctx' at program counter 'pc'.
20 * XXX Have to look into what the return values mean. XXX
22 int
23 prom_startcpu(int cpunode, struct linux_prom_registers *ctable_reg, int ctx, char *pc)
25 int ret;
26 unsigned long flags;
28 save_flags(flags); cli();
29 switch(prom_vers) {
30 case PROM_V0:
31 case PROM_V2:
32 case PROM_AP1000:
33 default:
34 ret = -1;
35 break;
36 case PROM_V3:
37 ret = (*(romvec->v3_cpustart))(cpunode, (int) ctable_reg, ctx, pc);
38 break;
40 restore_current();
41 restore_flags(flags);
43 return ret;
46 /* Stop CPU with device prom-tree node 'cpunode'.
47 * XXX Again, what does the return value really mean? XXX
49 int
50 prom_stopcpu(int cpunode)
52 int ret;
53 unsigned long flags;
55 save_flags(flags); cli();
56 switch(prom_vers) {
57 case PROM_V0:
58 case PROM_V2:
59 case PROM_AP1000:
60 default:
61 ret = -1;
62 break;
63 case PROM_V3:
64 ret = (*(romvec->v3_cpustop))(cpunode);
65 break;
67 restore_current();
68 restore_flags(flags);
70 return ret;
73 /* Make CPU with device prom-tree node 'cpunode' idle.
74 * XXX Return value, anyone? XXX
76 int
77 prom_idlecpu(int cpunode)
79 int ret;
80 unsigned long flags;
82 save_flags(flags); cli();
83 switch(prom_vers) {
84 case PROM_V0:
85 case PROM_V2:
86 case PROM_AP1000:
87 default:
88 ret = -1;
89 break;
90 case PROM_V3:
91 ret = (*(romvec->v3_cpuidle))(cpunode);
92 break;
94 restore_current();
95 restore_flags(flags);
97 return ret;
100 /* Resume the execution of CPU with nodeid 'cpunode'.
101 * XXX Come on, somebody has to know... XXX
104 prom_restartcpu(int cpunode)
106 int ret;
107 unsigned long flags;
109 save_flags(flags); cli();
110 switch(prom_vers) {
111 case PROM_V0:
112 case PROM_V2:
113 case PROM_AP1000:
114 default:
115 ret = -1;
116 break;
117 case PROM_V3:
118 ret = (*(romvec->v3_cpuresume))(cpunode);
119 break;
121 restore_current();
122 restore_flags(flags);
124 return ret;