RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / sparc / prom / mp.c
blobb41f8f71aed8adb6a73351a4c6101425c8a12cca
1 /*
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 int
18 prom_startcpu(int cpunode, struct linux_prom_registers *ctable_reg, int ctx, char *pc)
20 int ret;
21 unsigned long flags;
23 spin_lock_irqsave(&prom_lock, flags);
24 switch(prom_vers) {
25 case PROM_V0:
26 case PROM_V2:
27 default:
28 ret = -1;
29 break;
30 case PROM_V3:
31 ret = (*(romvec->v3_cpustart))(cpunode, (int) ctable_reg, ctx, pc);
32 break;
34 restore_current();
35 spin_unlock_irqrestore(&prom_lock, flags);
37 return ret;
40 int
41 prom_stopcpu(int cpunode)
43 int ret;
44 unsigned long flags;
46 spin_lock_irqsave(&prom_lock, flags);
47 switch(prom_vers) {
48 case PROM_V0:
49 case PROM_V2:
50 default:
51 ret = -1;
52 break;
53 case PROM_V3:
54 ret = (*(romvec->v3_cpustop))(cpunode);
55 break;
57 restore_current();
58 spin_unlock_irqrestore(&prom_lock, flags);
60 return ret;
63 int
64 prom_idlecpu(int cpunode)
66 int ret;
67 unsigned long flags;
69 spin_lock_irqsave(&prom_lock, flags);
70 switch(prom_vers) {
71 case PROM_V0:
72 case PROM_V2:
73 default:
74 ret = -1;
75 break;
76 case PROM_V3:
77 ret = (*(romvec->v3_cpuidle))(cpunode);
78 break;
80 restore_current();
81 spin_unlock_irqrestore(&prom_lock, flags);
83 return ret;
86 int
87 prom_restartcpu(int cpunode)
89 int ret;
90 unsigned long flags;
92 spin_lock_irqsave(&prom_lock, flags);
93 switch(prom_vers) {
94 case PROM_V0:
95 case PROM_V2:
96 default:
97 ret = -1;
98 break;
99 case PROM_V3:
100 ret = (*(romvec->v3_cpuresume))(cpunode);
101 break;
103 restore_current();
104 spin_unlock_irqrestore(&prom_lock, flags);
106 return ret;