xref: /onnv-gate/usr/src/psm/promif/ieee1275/common/prom_boot.c (revision 789:b348f31ed315)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23*789Sahrens  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*789Sahrens  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/promif.h>
300Sstevel@tonic-gate #include <sys/promimpl.h>
310Sstevel@tonic-gate 
320Sstevel@tonic-gate char *
prom_bootargs(void)330Sstevel@tonic-gate prom_bootargs(void)
340Sstevel@tonic-gate {
350Sstevel@tonic-gate 	int length;
36*789Sahrens 	pnode_t node;
370Sstevel@tonic-gate 	static char *name = "bootargs";
380Sstevel@tonic-gate 	static char bootargs[OBP_MAXPATHLEN];
390Sstevel@tonic-gate 
400Sstevel@tonic-gate 	if (bootargs[0] != (char)0)
410Sstevel@tonic-gate 		return (bootargs);
420Sstevel@tonic-gate 
430Sstevel@tonic-gate 	node = prom_chosennode();
440Sstevel@tonic-gate 	if ((node == OBP_NONODE) || (node == OBP_BADNODE))
450Sstevel@tonic-gate 		node = prom_rootnode();
460Sstevel@tonic-gate 	length = prom_getproplen(node, name);
470Sstevel@tonic-gate 	if ((length == -1) || (length == 0))
480Sstevel@tonic-gate 		return (NULL);
490Sstevel@tonic-gate 	if (length > OBP_MAXPATHLEN)
500Sstevel@tonic-gate 		length = OBP_MAXPATHLEN - 1;	/* Null terminator */
510Sstevel@tonic-gate 	(void) prom_bounded_getprop(node, name, bootargs, length);
520Sstevel@tonic-gate 	return (bootargs);
530Sstevel@tonic-gate }
540Sstevel@tonic-gate 
550Sstevel@tonic-gate 
560Sstevel@tonic-gate struct bootparam *
prom_bootparam(void)570Sstevel@tonic-gate prom_bootparam(void)
580Sstevel@tonic-gate {
590Sstevel@tonic-gate 	PROMIF_DPRINTF(("prom_bootparam on P1275?\n"));
600Sstevel@tonic-gate 	return ((struct bootparam *)0);
610Sstevel@tonic-gate }
620Sstevel@tonic-gate 
630Sstevel@tonic-gate char *
prom_bootpath(void)640Sstevel@tonic-gate prom_bootpath(void)
650Sstevel@tonic-gate {
660Sstevel@tonic-gate 	static char bootpath[OBP_MAXPATHLEN];
670Sstevel@tonic-gate 	int length;
68*789Sahrens 	pnode_t node;
690Sstevel@tonic-gate 	static char *name = "bootpath";
700Sstevel@tonic-gate 
710Sstevel@tonic-gate 	if (bootpath[0] != (char)0)
720Sstevel@tonic-gate 		return (bootpath);
730Sstevel@tonic-gate 
740Sstevel@tonic-gate 	node = prom_chosennode();
750Sstevel@tonic-gate 	if ((node == OBP_NONODE) || (node == OBP_BADNODE))
760Sstevel@tonic-gate 		node = prom_rootnode();
770Sstevel@tonic-gate 	length = prom_getproplen(node, name);
780Sstevel@tonic-gate 	if ((length == -1) || (length == 0))
790Sstevel@tonic-gate 		return (NULL);
800Sstevel@tonic-gate 	if (length > OBP_MAXPATHLEN)
810Sstevel@tonic-gate 		length = OBP_MAXPATHLEN - 1;	/* Null terminator */
820Sstevel@tonic-gate 	(void) prom_bounded_getprop(node, name, bootpath, length);
830Sstevel@tonic-gate 	return (bootpath);
840Sstevel@tonic-gate }
85