xref: /titanic_51/usr/src/uts/sparc/os/bootops.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate /*
30*7c478bd9Sstevel@tonic-gate  * Definitions of interfaces that provide services from the secondary
31*7c478bd9Sstevel@tonic-gate  * boot program to its clients (primarily Solaris, krtld, kmdb and their
32*7c478bd9Sstevel@tonic-gate  * successors.) This interface replaces the bootops (BOP) implementation
33*7c478bd9Sstevel@tonic-gate  * as the interface to be called by boot clients.
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  */
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
38*7c478bd9Sstevel@tonic-gate #include <sys/reboot.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/varargs.h>
41*7c478bd9Sstevel@tonic-gate #include <sys/obpdefs.h>
42*7c478bd9Sstevel@tonic-gate #include <sys/promif.h>
43*7c478bd9Sstevel@tonic-gate #include <sys/bootconf.h>
44*7c478bd9Sstevel@tonic-gate #include <sys/bootstat.h>
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate /*
47*7c478bd9Sstevel@tonic-gate  * Implementation of the "version" boot service.
48*7c478bd9Sstevel@tonic-gate  * Return the compiled version number of this implementation.
49*7c478bd9Sstevel@tonic-gate  *
50*7c478bd9Sstevel@tonic-gate  * Note: An individual service can be tested for and versioned with
51*7c478bd9Sstevel@tonic-gate  * bop_serviceavail();
52*7c478bd9Sstevel@tonic-gate  *
53*7c478bd9Sstevel@tonic-gate  * Calling spec:
54*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
55*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
56*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
57*7c478bd9Sstevel@tonic-gate  * args[3] Res0: returned version number
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate uint_t
60*7c478bd9Sstevel@tonic-gate bop_getversion(struct bootops *bop)
61*7c478bd9Sstevel@tonic-gate {
62*7c478bd9Sstevel@tonic-gate 	return (bop->bsys_version);
63*7c478bd9Sstevel@tonic-gate }
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate /*
67*7c478bd9Sstevel@tonic-gate  * Implementation of the "open" boot service.
68*7c478bd9Sstevel@tonic-gate  *
69*7c478bd9Sstevel@tonic-gate  * Calling spec:
70*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
71*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
72*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
73*7c478bd9Sstevel@tonic-gate  * args[3] filename string
74*7c478bd9Sstevel@tonic-gate  * args[4] flags
75*7c478bd9Sstevel@tonic-gate  * args[5] Res0: returned result
76*7c478bd9Sstevel@tonic-gate  *
77*7c478bd9Sstevel@tonic-gate  */
78*7c478bd9Sstevel@tonic-gate int
79*7c478bd9Sstevel@tonic-gate bop_open(struct bootops *bop, char *name, int flags)
80*7c478bd9Sstevel@tonic-gate {
81*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[6];
82*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
85*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("open");
86*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
87*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(name);
90*7c478bd9Sstevel@tonic-gate 	args[4] = boot_int2cell(flags);
91*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
92*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[5]));
93*7c478bd9Sstevel@tonic-gate }
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate /*
96*7c478bd9Sstevel@tonic-gate  * Implementation of the "read" boot service.
97*7c478bd9Sstevel@tonic-gate  *
98*7c478bd9Sstevel@tonic-gate  * Calling spec:
99*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
100*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
101*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
102*7c478bd9Sstevel@tonic-gate  * args[3] boot-opened file descriptor
103*7c478bd9Sstevel@tonic-gate  * args[4] client's buffer
104*7c478bd9Sstevel@tonic-gate  * args[5] size of read request
105*7c478bd9Sstevel@tonic-gate  * args[6] Res0: returned result
106*7c478bd9Sstevel@tonic-gate  *
107*7c478bd9Sstevel@tonic-gate  */
108*7c478bd9Sstevel@tonic-gate int
109*7c478bd9Sstevel@tonic-gate bop_read(struct bootops *bop, int fd, caddr_t buf, size_t size)
110*7c478bd9Sstevel@tonic-gate {
111*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[7];
112*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
115*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("read");
116*7c478bd9Sstevel@tonic-gate 	args[1] = 3;
117*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate 	args[3] = boot_int2cell(fd);
120*7c478bd9Sstevel@tonic-gate 	args[4] = boot_ptr2cell(buf);
121*7c478bd9Sstevel@tonic-gate 	args[5] = boot_uint2cell(size);
122*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
123*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[6]));
124*7c478bd9Sstevel@tonic-gate }
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate /*
127*7c478bd9Sstevel@tonic-gate  * Implementation of the "seek" boot service.
128*7c478bd9Sstevel@tonic-gate  *
129*7c478bd9Sstevel@tonic-gate  * Calling spec:
130*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
131*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
132*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
133*7c478bd9Sstevel@tonic-gate  * args[3] boot-opened file descriptor
134*7c478bd9Sstevel@tonic-gate  * args[4] offset hi		XXX just use one cell for offset?
135*7c478bd9Sstevel@tonic-gate  * args[5] offset lo
136*7c478bd9Sstevel@tonic-gate  * args[6] Res0: returned result
137*7c478bd9Sstevel@tonic-gate  */
138*7c478bd9Sstevel@tonic-gate int
139*7c478bd9Sstevel@tonic-gate bop_seek(struct bootops *bop, int fd, off_t hi, off_t lo)
140*7c478bd9Sstevel@tonic-gate {
141*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[7];
142*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
145*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("seek");
146*7c478bd9Sstevel@tonic-gate 	args[1] = 3;
147*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate 	args[3] = boot_int2cell(fd);
150*7c478bd9Sstevel@tonic-gate 	args[4] = boot_offt2cell(hi);
151*7c478bd9Sstevel@tonic-gate 	args[5] = boot_offt2cell(lo);
152*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
153*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[6]));
154*7c478bd9Sstevel@tonic-gate }
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate /*
157*7c478bd9Sstevel@tonic-gate  * Implementation of the "close" boot service.
158*7c478bd9Sstevel@tonic-gate  *
159*7c478bd9Sstevel@tonic-gate  * Calling spec:
160*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
161*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
162*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
163*7c478bd9Sstevel@tonic-gate  * args[3] boot-opened file descriptor
164*7c478bd9Sstevel@tonic-gate  * args[4] Res0: returned result
165*7c478bd9Sstevel@tonic-gate  */
166*7c478bd9Sstevel@tonic-gate int
167*7c478bd9Sstevel@tonic-gate bop_close(struct bootops *bop, int fd)
168*7c478bd9Sstevel@tonic-gate {
169*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[5];
170*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
173*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("close");
174*7c478bd9Sstevel@tonic-gate 	args[1] = 1;
175*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate 	args[3] = boot_int2cell(fd);
178*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
179*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[4]));
180*7c478bd9Sstevel@tonic-gate }
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate /*
183*7c478bd9Sstevel@tonic-gate  * Implementation of the "alloc" boot service.
184*7c478bd9Sstevel@tonic-gate  *
185*7c478bd9Sstevel@tonic-gate  * Calling spec:
186*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
187*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
188*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
189*7c478bd9Sstevel@tonic-gate  * args[3] virtual hint
190*7c478bd9Sstevel@tonic-gate  * args[4] size to allocate
191*7c478bd9Sstevel@tonic-gate  * args[5] alignment
192*7c478bd9Sstevel@tonic-gate  * args[6] Res0: returned result
193*7c478bd9Sstevel@tonic-gate  */
194*7c478bd9Sstevel@tonic-gate caddr_t
195*7c478bd9Sstevel@tonic-gate bop_alloc(struct bootops *bop, caddr_t virthint, size_t size, int align)
196*7c478bd9Sstevel@tonic-gate {
197*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[7];
198*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
199*7c478bd9Sstevel@tonic-gate 
200*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
201*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("alloc");
202*7c478bd9Sstevel@tonic-gate 	args[1] = 3;
203*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(virthint);
206*7c478bd9Sstevel@tonic-gate 	args[4] = boot_size2cell(size);
207*7c478bd9Sstevel@tonic-gate 	args[5] = boot_int2cell(align);
208*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
209*7c478bd9Sstevel@tonic-gate 	return ((caddr_t)boot_ptr2cell(args[6]));
210*7c478bd9Sstevel@tonic-gate }
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate /*
213*7c478bd9Sstevel@tonic-gate  * Implementation of the "alloc_virt" boot service
214*7c478bd9Sstevel@tonic-gate  *
215*7c478bd9Sstevel@tonic-gate  * Calling spec:
216*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
217*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
218*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
219*7c478bd9Sstevel@tonic-gate  * args[3] virtual address
220*7c478bd9Sstevel@tonic-gate  * args[4] size to allocate
221*7c478bd9Sstevel@tonic-gate  * args[5] Resi: returned result
222*7c478bd9Sstevel@tonic-gate  */
223*7c478bd9Sstevel@tonic-gate caddr_t
224*7c478bd9Sstevel@tonic-gate bop_alloc_virt(struct bootops *bop, caddr_t virt, size_t size)
225*7c478bd9Sstevel@tonic-gate {
226*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[6];
227*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
228*7c478bd9Sstevel@tonic-gate 
229*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
230*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("alloc_virt");
231*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
232*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
233*7c478bd9Sstevel@tonic-gate 
234*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(virt);
235*7c478bd9Sstevel@tonic-gate 	args[4] = boot_size2cell(size);
236*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
237*7c478bd9Sstevel@tonic-gate 	return ((caddr_t)boot_ptr2cell(args[5]));
238*7c478bd9Sstevel@tonic-gate }
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate /*
241*7c478bd9Sstevel@tonic-gate  * Implementation of the "free" boot service.
242*7c478bd9Sstevel@tonic-gate  *
243*7c478bd9Sstevel@tonic-gate  * Calling spec:
244*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
245*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
246*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
247*7c478bd9Sstevel@tonic-gate  * args[3] virtual hint
248*7c478bd9Sstevel@tonic-gate  * args[4] size to free
249*7c478bd9Sstevel@tonic-gate  * args[5] Res0: returned result
250*7c478bd9Sstevel@tonic-gate  */
251*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
252*7c478bd9Sstevel@tonic-gate void
253*7c478bd9Sstevel@tonic-gate bop_free(struct bootops *bop, caddr_t virt, size_t size)
254*7c478bd9Sstevel@tonic-gate {
255*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[6];
256*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
257*7c478bd9Sstevel@tonic-gate 
258*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
259*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("free");
260*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
261*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(virt);
264*7c478bd9Sstevel@tonic-gate 	args[4] = boot_size2cell(size);
265*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
266*7c478bd9Sstevel@tonic-gate }
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate /*
269*7c478bd9Sstevel@tonic-gate  * Implementation of the "map" boot service.
270*7c478bd9Sstevel@tonic-gate  *
271*7c478bd9Sstevel@tonic-gate  * Calling spec:
272*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
273*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
274*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
275*7c478bd9Sstevel@tonic-gate  * args[3] virtual address
276*7c478bd9Sstevel@tonic-gate  * args[4] space of phys addr
277*7c478bd9Sstevel@tonic-gate  * args[5] phys addr
278*7c478bd9Sstevel@tonic-gate  * args[6] size
279*7c478bd9Sstevel@tonic-gate  * args[7] Res0: returned result
280*7c478bd9Sstevel@tonic-gate  */
281*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
282*7c478bd9Sstevel@tonic-gate caddr_t
283*7c478bd9Sstevel@tonic-gate bop_map(struct bootops *bop, caddr_t virt, int space,
284*7c478bd9Sstevel@tonic-gate 	caddr_t phys, size_t size)
285*7c478bd9Sstevel@tonic-gate {
286*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[8];
287*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
288*7c478bd9Sstevel@tonic-gate 
289*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
290*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("map");
291*7c478bd9Sstevel@tonic-gate 	args[1] = 3;
292*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(virt);
295*7c478bd9Sstevel@tonic-gate 	args[4] = boot_int2cell(space);
296*7c478bd9Sstevel@tonic-gate 	args[5] = boot_ptr2cell(phys);
297*7c478bd9Sstevel@tonic-gate 	args[6] = boot_size2cell(size);
298*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
299*7c478bd9Sstevel@tonic-gate 	return ((caddr_t)boot_cell2ptr(args[7]));
300*7c478bd9Sstevel@tonic-gate }
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate /*
303*7c478bd9Sstevel@tonic-gate  * Implementation of the "unmap" boot service.
304*7c478bd9Sstevel@tonic-gate  *
305*7c478bd9Sstevel@tonic-gate  * Calling spec:
306*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
307*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
308*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
309*7c478bd9Sstevel@tonic-gate  * args[3] virtual address
310*7c478bd9Sstevel@tonic-gate  * args[4] size of chunk
311*7c478bd9Sstevel@tonic-gate  * args[5] Res0: returned result
312*7c478bd9Sstevel@tonic-gate  */
313*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
314*7c478bd9Sstevel@tonic-gate void
315*7c478bd9Sstevel@tonic-gate bop_unmap(struct bootops *bop, caddr_t virt, size_t size)
316*7c478bd9Sstevel@tonic-gate {
317*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[6];
318*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
319*7c478bd9Sstevel@tonic-gate 
320*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
321*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("unmap");
322*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
323*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
324*7c478bd9Sstevel@tonic-gate 
325*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(virt);
326*7c478bd9Sstevel@tonic-gate 	args[4] = boot_size2cell(size);
327*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
328*7c478bd9Sstevel@tonic-gate }
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate /*
331*7c478bd9Sstevel@tonic-gate  * Implementation of the "quiesce" boot service.
332*7c478bd9Sstevel@tonic-gate  *
333*7c478bd9Sstevel@tonic-gate  * Calling spec:
334*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
335*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
336*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
337*7c478bd9Sstevel@tonic-gate  * args[3] Res0: returned result
338*7c478bd9Sstevel@tonic-gate  */
339*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
340*7c478bd9Sstevel@tonic-gate void
341*7c478bd9Sstevel@tonic-gate bop_quiesce_io(struct bootops *bop)
342*7c478bd9Sstevel@tonic-gate {
343*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[4];
344*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
345*7c478bd9Sstevel@tonic-gate 
346*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
347*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("quiesce");
348*7c478bd9Sstevel@tonic-gate 	args[1] = 0;
349*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
350*7c478bd9Sstevel@tonic-gate 
351*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
352*7c478bd9Sstevel@tonic-gate }
353*7c478bd9Sstevel@tonic-gate 
354*7c478bd9Sstevel@tonic-gate /*
355*7c478bd9Sstevel@tonic-gate  * Implementation of the "getproplen" boot service.
356*7c478bd9Sstevel@tonic-gate  *
357*7c478bd9Sstevel@tonic-gate  * Calling spec:
358*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
359*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
360*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
361*7c478bd9Sstevel@tonic-gate  * args[3] property name string
362*7c478bd9Sstevel@tonic-gate  * args[4] Res0: returned result
363*7c478bd9Sstevel@tonic-gate  */
364*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
365*7c478bd9Sstevel@tonic-gate int
366*7c478bd9Sstevel@tonic-gate bop_getproplen(struct bootops *bop, char *name)
367*7c478bd9Sstevel@tonic-gate {
368*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[7];
369*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
370*7c478bd9Sstevel@tonic-gate 
371*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
372*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("getproplen");
373*7c478bd9Sstevel@tonic-gate 	args[1] = 1;
374*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
375*7c478bd9Sstevel@tonic-gate 
376*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(name);
377*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
378*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[4]));
379*7c478bd9Sstevel@tonic-gate }
380*7c478bd9Sstevel@tonic-gate 
381*7c478bd9Sstevel@tonic-gate /*
382*7c478bd9Sstevel@tonic-gate  * Implementation of the "getprop" boot service.
383*7c478bd9Sstevel@tonic-gate  *
384*7c478bd9Sstevel@tonic-gate  * Calling spec:
385*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
386*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
387*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
388*7c478bd9Sstevel@tonic-gate  * args[3] property name string
389*7c478bd9Sstevel@tonic-gate  * args[4] buffer pointer to hold value of the property
390*7c478bd9Sstevel@tonic-gate  * args[5] Res0: returned result
391*7c478bd9Sstevel@tonic-gate  */
392*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
393*7c478bd9Sstevel@tonic-gate int
394*7c478bd9Sstevel@tonic-gate bop_getprop(struct bootops *bop, char *name, void *value)
395*7c478bd9Sstevel@tonic-gate {
396*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[6];
397*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
398*7c478bd9Sstevel@tonic-gate 
399*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
400*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("getprop");
401*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
402*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
403*7c478bd9Sstevel@tonic-gate 
404*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(name);
405*7c478bd9Sstevel@tonic-gate 	args[4] = boot_ptr2cell(value);
406*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
407*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[5]));
408*7c478bd9Sstevel@tonic-gate }
409*7c478bd9Sstevel@tonic-gate 
410*7c478bd9Sstevel@tonic-gate /*
411*7c478bd9Sstevel@tonic-gate  * Implementation of the "nextprop" boot service.
412*7c478bd9Sstevel@tonic-gate  *
413*7c478bd9Sstevel@tonic-gate  * Calling spec:
414*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
415*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
416*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
417*7c478bd9Sstevel@tonic-gate  * args[3] previous property name string
418*7c478bd9Sstevel@tonic-gate  * args[4] Res0: returned result
419*7c478bd9Sstevel@tonic-gate  */
420*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
421*7c478bd9Sstevel@tonic-gate char *
422*7c478bd9Sstevel@tonic-gate bop_nextprop(struct bootops *bop, char *prevprop)
423*7c478bd9Sstevel@tonic-gate {
424*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[5];
425*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
426*7c478bd9Sstevel@tonic-gate 
427*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
428*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("nextprop");
429*7c478bd9Sstevel@tonic-gate 	args[1] = 1;
430*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
431*7c478bd9Sstevel@tonic-gate 
432*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(prevprop);
433*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
434*7c478bd9Sstevel@tonic-gate 	return ((char *)boot_cell2ptr(args[4]));
435*7c478bd9Sstevel@tonic-gate }
436*7c478bd9Sstevel@tonic-gate 
437*7c478bd9Sstevel@tonic-gate /*
438*7c478bd9Sstevel@tonic-gate  * Implementation of the "puts" boot service.
439*7c478bd9Sstevel@tonic-gate  *
440*7c478bd9Sstevel@tonic-gate  * Calling spec:
441*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
442*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
443*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
444*7c478bd9Sstevel@tonic-gate  * args[3] string to print
445*7c478bd9Sstevel@tonic-gate  */
446*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
447*7c478bd9Sstevel@tonic-gate void
448*7c478bd9Sstevel@tonic-gate bop_puts(struct bootops *bop, char *string)
449*7c478bd9Sstevel@tonic-gate {
450*7c478bd9Sstevel@tonic-gate 	boot_cell_t	args[6];
451*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
452*7c478bd9Sstevel@tonic-gate 	void	(*bsys_printf)(struct bootops *, char *, ...);
453*7c478bd9Sstevel@tonic-gate 
454*7c478bd9Sstevel@tonic-gate 	/* so new kernel, old boot can print a message before dying */
455*7c478bd9Sstevel@tonic-gate 	if (!BOOTOPS_ARE_1275(bop)) {
456*7c478bd9Sstevel@tonic-gate 		bsys_printf = (void (*)(struct bootops *, char *, ...))
457*7c478bd9Sstevel@tonic-gate 		    (bop->bsys_printf);
458*7c478bd9Sstevel@tonic-gate 		(*bsys_printf)(bop, string);
459*7c478bd9Sstevel@tonic-gate 		return;
460*7c478bd9Sstevel@tonic-gate 	}
461*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
462*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("puts");
463*7c478bd9Sstevel@tonic-gate 	args[1] = 1;
464*7c478bd9Sstevel@tonic-gate 	args[2] = 0;
465*7c478bd9Sstevel@tonic-gate 
466*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(string);
467*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
468*7c478bd9Sstevel@tonic-gate 
469*7c478bd9Sstevel@tonic-gate }
470*7c478bd9Sstevel@tonic-gate 
471*7c478bd9Sstevel@tonic-gate /*
472*7c478bd9Sstevel@tonic-gate  * Implementation of the "putsarg" boot service.
473*7c478bd9Sstevel@tonic-gate  *
474*7c478bd9Sstevel@tonic-gate  * Calling spec:
475*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
476*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
477*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
478*7c478bd9Sstevel@tonic-gate  * args[3] string to print (with '%*' format)
479*7c478bd9Sstevel@tonic-gate  * args[4] 64-bit thing to print
480*7c478bd9Sstevel@tonic-gate  */
481*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
482*7c478bd9Sstevel@tonic-gate void
483*7c478bd9Sstevel@tonic-gate bop_putsarg(struct bootops *bop, const char *string, ...)
484*7c478bd9Sstevel@tonic-gate {
485*7c478bd9Sstevel@tonic-gate 	boot_cell_t	args[6];
486*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
487*7c478bd9Sstevel@tonic-gate 	void	(*bsys_printf)(struct bootops *, char *, ...);
488*7c478bd9Sstevel@tonic-gate 	va_list		ap;
489*7c478bd9Sstevel@tonic-gate 	const char	*fmt = string;
490*7c478bd9Sstevel@tonic-gate 	int		ells = 0;
491*7c478bd9Sstevel@tonic-gate 	uint64_t	arg;
492*7c478bd9Sstevel@tonic-gate 
493*7c478bd9Sstevel@tonic-gate 	/*
494*7c478bd9Sstevel@tonic-gate 	 * We need to do the minimum printf-like stuff here to figure
495*7c478bd9Sstevel@tonic-gate 	 * out the size of argument, if present.
496*7c478bd9Sstevel@tonic-gate 	 */
497*7c478bd9Sstevel@tonic-gate 	while (*fmt) {
498*7c478bd9Sstevel@tonic-gate 		if (*fmt++ != '%')
499*7c478bd9Sstevel@tonic-gate 			continue;
500*7c478bd9Sstevel@tonic-gate 		if (*fmt == '%') {
501*7c478bd9Sstevel@tonic-gate 			fmt++;
502*7c478bd9Sstevel@tonic-gate 			continue;
503*7c478bd9Sstevel@tonic-gate 		}
504*7c478bd9Sstevel@tonic-gate 
505*7c478bd9Sstevel@tonic-gate 		while (*fmt >= '0' && *fmt <= '9')
506*7c478bd9Sstevel@tonic-gate 			fmt++;
507*7c478bd9Sstevel@tonic-gate 		for (ells = 0; *fmt == 'l'; fmt++)
508*7c478bd9Sstevel@tonic-gate 			ells++;
509*7c478bd9Sstevel@tonic-gate 		va_start(ap, string);
510*7c478bd9Sstevel@tonic-gate 		switch (*fmt) {
511*7c478bd9Sstevel@tonic-gate 		case 's':
512*7c478bd9Sstevel@tonic-gate 			arg = (uint64_t)va_arg(ap, char *);
513*7c478bd9Sstevel@tonic-gate 			break;
514*7c478bd9Sstevel@tonic-gate 		case 'p':
515*7c478bd9Sstevel@tonic-gate 			arg = (uint64_t)va_arg(ap, void *);
516*7c478bd9Sstevel@tonic-gate 			break;
517*7c478bd9Sstevel@tonic-gate 		case 'd':
518*7c478bd9Sstevel@tonic-gate 		case 'D':
519*7c478bd9Sstevel@tonic-gate 		case 'x':
520*7c478bd9Sstevel@tonic-gate 		case 'X':
521*7c478bd9Sstevel@tonic-gate 		case 'u':
522*7c478bd9Sstevel@tonic-gate 		case 'U':
523*7c478bd9Sstevel@tonic-gate 		case 'o':
524*7c478bd9Sstevel@tonic-gate 		case 'O':
525*7c478bd9Sstevel@tonic-gate 			if (ells == 0)
526*7c478bd9Sstevel@tonic-gate 				arg = (uint64_t)va_arg(ap, uint_t);
527*7c478bd9Sstevel@tonic-gate 			else if (ells == 1)
528*7c478bd9Sstevel@tonic-gate 				arg = (uint64_t)va_arg(ap, ulong_t);
529*7c478bd9Sstevel@tonic-gate 			else
530*7c478bd9Sstevel@tonic-gate 				arg = (uint64_t)va_arg(ap, uint64_t);
531*7c478bd9Sstevel@tonic-gate 			break;
532*7c478bd9Sstevel@tonic-gate 		default:
533*7c478bd9Sstevel@tonic-gate 			arg = (uint64_t)va_arg(ap, uint_t);
534*7c478bd9Sstevel@tonic-gate 			break;
535*7c478bd9Sstevel@tonic-gate 		}
536*7c478bd9Sstevel@tonic-gate 		va_end(ap);
537*7c478bd9Sstevel@tonic-gate 		break;
538*7c478bd9Sstevel@tonic-gate 	}
539*7c478bd9Sstevel@tonic-gate 
540*7c478bd9Sstevel@tonic-gate 	/* so new kernel, old boot can print a message before dying */
541*7c478bd9Sstevel@tonic-gate 	if (!BOOTOPS_ARE_1275(bop)) {
542*7c478bd9Sstevel@tonic-gate 		bsys_printf = (void (*)(struct bootops *, char *, ...))
543*7c478bd9Sstevel@tonic-gate 		    (bop->bsys_printf);
544*7c478bd9Sstevel@tonic-gate 		(*bsys_printf)(bop, (char *)string, arg);
545*7c478bd9Sstevel@tonic-gate 		return;
546*7c478bd9Sstevel@tonic-gate 	}
547*7c478bd9Sstevel@tonic-gate 
548*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
549*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("putsarg");
550*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
551*7c478bd9Sstevel@tonic-gate 	args[2] = 0;
552*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(string);
553*7c478bd9Sstevel@tonic-gate 	args[4] = boot_uint642cell(arg);
554*7c478bd9Sstevel@tonic-gate 
555*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
556*7c478bd9Sstevel@tonic-gate }
557*7c478bd9Sstevel@tonic-gate 
558*7c478bd9Sstevel@tonic-gate /*
559*7c478bd9Sstevel@tonic-gate  * Implementation of the "mount" boot service.
560*7c478bd9Sstevel@tonic-gate  *
561*7c478bd9Sstevel@tonic-gate  * Calling spec:
562*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
563*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
564*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
565*7c478bd9Sstevel@tonic-gate  * args[3] pathname string
566*7c478bd9Sstevel@tonic-gate  * args[4] Res0: returned result
567*7c478bd9Sstevel@tonic-gate  */
568*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
569*7c478bd9Sstevel@tonic-gate int
570*7c478bd9Sstevel@tonic-gate bop_mountroot(struct bootops *bop, char *path)
571*7c478bd9Sstevel@tonic-gate {
572*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[5];
573*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
574*7c478bd9Sstevel@tonic-gate 
575*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
576*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("mountroot");
577*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
578*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
579*7c478bd9Sstevel@tonic-gate 
580*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(path);
581*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
582*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[4]));
583*7c478bd9Sstevel@tonic-gate }
584*7c478bd9Sstevel@tonic-gate 
585*7c478bd9Sstevel@tonic-gate /*
586*7c478bd9Sstevel@tonic-gate  * Implementation of the "unmountroot" boot service.
587*7c478bd9Sstevel@tonic-gate  *
588*7c478bd9Sstevel@tonic-gate  * Calling spec:
589*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
590*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
591*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
592*7c478bd9Sstevel@tonic-gate  * args[3] Res0: returned result
593*7c478bd9Sstevel@tonic-gate  */
594*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
595*7c478bd9Sstevel@tonic-gate int
596*7c478bd9Sstevel@tonic-gate bop_unmountroot(struct bootops *bop)
597*7c478bd9Sstevel@tonic-gate {
598*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[4];
599*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
600*7c478bd9Sstevel@tonic-gate 
601*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
602*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("unmountroot");
603*7c478bd9Sstevel@tonic-gate 	args[1] = 0;
604*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
605*7c478bd9Sstevel@tonic-gate 
606*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
607*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[3]));
608*7c478bd9Sstevel@tonic-gate }
609*7c478bd9Sstevel@tonic-gate 
610*7c478bd9Sstevel@tonic-gate /*
611*7c478bd9Sstevel@tonic-gate  * Implementation of the "serviceavail" boot service.
612*7c478bd9Sstevel@tonic-gate  *
613*7c478bd9Sstevel@tonic-gate  * Calling spec:
614*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
615*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
616*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
617*7c478bd9Sstevel@tonic-gate  * args[3] name string of service to be tested for
618*7c478bd9Sstevel@tonic-gate  * args[4] Res0: returned version number or 0
619*7c478bd9Sstevel@tonic-gate  */
620*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
621*7c478bd9Sstevel@tonic-gate int
622*7c478bd9Sstevel@tonic-gate bop_serviceavail(struct bootops *bop, char *name)
623*7c478bd9Sstevel@tonic-gate {
624*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[5];
625*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *) =
626*7c478bd9Sstevel@tonic-gate 	    (int (*)(void *))bop->bsys_1275_call;
627*7c478bd9Sstevel@tonic-gate 
628*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("serviceavail");
629*7c478bd9Sstevel@tonic-gate 	args[1] = 1;
630*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
631*7c478bd9Sstevel@tonic-gate 
632*7c478bd9Sstevel@tonic-gate 	args[3] = boot_ptr2cell(name);
633*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
634*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[4]));
635*7c478bd9Sstevel@tonic-gate }
636*7c478bd9Sstevel@tonic-gate 
637*7c478bd9Sstevel@tonic-gate /*
638*7c478bd9Sstevel@tonic-gate  * Implementation of the "fstat" boot service.
639*7c478bd9Sstevel@tonic-gate  *
640*7c478bd9Sstevel@tonic-gate  * Calling spec:
641*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
642*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells
643*7c478bd9Sstevel@tonic-gate  * args[2] #result cells
644*7c478bd9Sstevel@tonic-gate  * args[3] fd
645*7c478bd9Sstevel@tonic-gate  * args[4] client's stat structure
646*7c478bd9Sstevel@tonic-gate  */
647*7c478bd9Sstevel@tonic-gate int
648*7c478bd9Sstevel@tonic-gate bop_fstat(struct bootops *bop, int fd, struct bootstat *st)
649*7c478bd9Sstevel@tonic-gate {
650*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[6];
651*7c478bd9Sstevel@tonic-gate 	int	(*bsys_1275_call)(void *);
652*7c478bd9Sstevel@tonic-gate 
653*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
654*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("fstat");
655*7c478bd9Sstevel@tonic-gate 	args[1] = 2;
656*7c478bd9Sstevel@tonic-gate 	args[2] = 1;
657*7c478bd9Sstevel@tonic-gate 	args[3] = boot_int2cell(fd);
658*7c478bd9Sstevel@tonic-gate 	args[4] = boot_ptr2cell(st);
659*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
660*7c478bd9Sstevel@tonic-gate 	return (boot_cell2int(args[5]));
661*7c478bd9Sstevel@tonic-gate }
662*7c478bd9Sstevel@tonic-gate 
663*7c478bd9Sstevel@tonic-gate /*
664*7c478bd9Sstevel@tonic-gate  * Implementation of the "enter_mon" boot service.
665*7c478bd9Sstevel@tonic-gate  *
666*7c478bd9Sstevel@tonic-gate  * Calling spec:
667*7c478bd9Sstevel@tonic-gate  * args[0] Service name string
668*7c478bd9Sstevel@tonic-gate  * args[1] #argument cells (0)
669*7c478bd9Sstevel@tonic-gate  * args[2] #result cells (0)
670*7c478bd9Sstevel@tonic-gate  */
671*7c478bd9Sstevel@tonic-gate void
672*7c478bd9Sstevel@tonic-gate bop_enter_mon(struct bootops *bop)
673*7c478bd9Sstevel@tonic-gate {
674*7c478bd9Sstevel@tonic-gate 	boot_cell_t args[4];
675*7c478bd9Sstevel@tonic-gate 	int (*bsys_1275_call)(void *);
676*7c478bd9Sstevel@tonic-gate 
677*7c478bd9Sstevel@tonic-gate 	bsys_1275_call = (int (*)(void *))bop->bsys_1275_call;
678*7c478bd9Sstevel@tonic-gate 	args[0] = boot_ptr2cell("enter_mon");
679*7c478bd9Sstevel@tonic-gate 	args[1] = 0;
680*7c478bd9Sstevel@tonic-gate 	args[2] = 0;
681*7c478bd9Sstevel@tonic-gate 	(void) (bsys_1275_call)(args);
682*7c478bd9Sstevel@tonic-gate }
683