import less(1)
[unleashed/tickless.git] / usr / src / psm / promif / ieee1275 / sun4 / prom_cpuctl.c
blob792e7742a38e7ed158cbf88ec6859056e7fb6cdd
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/promif.h>
30 #include <sys/promimpl.h>
32 int
33 prom_stopcpu_bycpuid(int cpuid)
35 cell_t ci[5];
37 ci[0] = p1275_ptr2cell("SUNW,stop-cpu-by-cpuid"); /* Service name */
38 ci[1] = (cell_t)1; /* #argument cells */
39 ci[2] = (cell_t)1; /* #result cells */
40 ci[3] = p1275_int2cell(cpuid); /* Arg1: cpuid to stop */
42 promif_preprom();
43 (void) p1275_cif_handler(&ci);
44 promif_postprom();
46 return (p1275_cell2int(ci[4]));
50 int
51 prom_startcpu(pnode_t node, caddr_t pc, int arg)
53 cell_t ci[6];
55 ci[0] = p1275_ptr2cell("SUNW,start-cpu"); /* Service name */
56 ci[1] = (cell_t)3; /* #argument cells */
57 ci[2] = (cell_t)0; /* #result cells */
58 ci[3] = p1275_dnode2cell(node); /* Arg1: nodeid to start */
59 ci[4] = p1275_ptr2cell(pc); /* Arg2: pc */
60 ci[5] = p1275_int2cell(arg); /* Arg3: cpuid */
62 promif_preprom();
63 (void) p1275_cif_handler(&ci);
64 promif_postprom();
66 return (0);
69 int
70 prom_startcpu_bycpuid(int cpuid, caddr_t pc, int arg)
72 cell_t ci[7];
74 ci[0] = p1275_ptr2cell("SUNW,start-cpu-by-cpuid"); /* Service name */
75 ci[1] = (cell_t)3; /* #argument cells */
76 ci[2] = (cell_t)1; /* #result cells */
77 ci[3] = p1275_int2cell(cpuid); /* Arg1: cpuid to start */
78 ci[4] = p1275_ptr2cell(pc); /* Arg2: pc */
79 ci[5] = p1275_int2cell(arg); /* Arg3: cpuid */
81 promif_preprom();
82 (void) p1275_cif_handler(&ci);
83 promif_postprom();
85 return (p1275_cell2int(ci[6]));
88 int
89 prom_wakeupcpu(pnode_t node)
91 cell_t ci[5];
92 int rv;
94 ci[0] = p1275_ptr2cell("SUNW,wakeup-cpu"); /* Service name */
95 ci[1] = (cell_t)1; /* #argument cells */
96 ci[2] = (cell_t)1; /* #result cells */
97 ci[3] = p1275_dnode2cell(node); /* Arg1: nodeid to wakeup */
99 promif_preprom();
100 rv = p1275_cif_handler(&ci);
101 promif_postprom();
103 if (rv != 0)
104 return (rv);
105 else
106 return (p1275_cell2int(ci[4])); /* Res1: Catch result */
110 prom_cpuoff(pnode_t node)
112 cell_t ci[5];
113 int rv;
115 ci[0] = p1275_ptr2cell("SUNW,park-cpu");
116 ci[1] = (cell_t)1; /* #argument cells */
117 ci[2] = (cell_t)1; /* #return cells */
118 ci[3] = p1275_dnode2cell(node);
120 promif_preprom();
121 rv = p1275_cif_handler(&ci);
122 promif_postprom();
124 if (rv != 0)
125 return (-1);
127 return (p1275_cell2int(ci[4]));
131 prom_hotaddcpu(int cpuid)
133 cell_t ci[5];
135 ci[0] = p1275_ptr2cell("SUNW,hotadd-cpu-by-cpuid"); /* Service name */
136 ci[1] = (cell_t)1; /* #argument cells */
137 ci[2] = (cell_t)1; /* #result cells */
138 ci[3] = p1275_int2cell(cpuid); /* Arg1: cpuid to start */
140 promif_preprom();
141 (void) p1275_cif_handler(&ci);
142 promif_postprom();
144 return (p1275_cell2int(ci[4]));
148 prom_hotremovecpu(int cpuid)
150 cell_t ci[5];
152 ci[0] = p1275_ptr2cell("SUNW,hotremove-cpu-by-cpuid"); /* Service */
153 ci[1] = (cell_t)1; /* #argument cells */
154 ci[2] = (cell_t)1; /* #result cells */
155 ci[3] = p1275_int2cell(cpuid); /* Arg1: cpuid to start */
157 promif_preprom();
158 (void) p1275_cif_handler(&ci);
159 promif_postprom();
161 return (p1275_cell2int(ci[4]));