/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/promimpl.h>
/*
* Routines for walking the PROMs devinfo tree
*/
{
(void) p1275_cif_handler(&ci);
}
{
(void) p1275_cif_handler(&ci);
}
/*
* prom_walk_devs() implements a generic walker for the OBP tree; this
* implementation uses an explicitly managed stack in order to save the
* overhead of a recursive implementation.
*/
void
void *result)
{
int stackidx = 0;
prom_panic("Invalid node specified as root of prom tree walk");
}
for (;;) {
/*
* We're out of stuff to do at this level, bump back up a level
* in the tree, and move to the next node; if the new level
* will be level -1, we're done.
*/
stackidx--;
if (stackidx < 0)
return;
continue;
}
case PROM_WALK_TERMINATE:
return;
case PROM_WALK_CONTINUE:
/*
* If curnode has a child, traverse to it,
* otherwise move to curnode's sibling.
*/
stackidx++;
} else {
}
break;
default:
prom_panic("unrecognized walk directive");
}
}
}
/*
* prom_findnode_bydevtype() searches the prom device subtree rooted at 'node'
* and returns the first node whose device type property matches the type
* supplied in 'devtype'.
*/
static int
{
return (PROM_WALK_TERMINATE);
}
return (PROM_WALK_CONTINUE);
}
{
return (result);
}
/*
* prom_findnode_byname() searches the prom device subtree rooted at 'node' and
* returns the first node whose name matches the name supplied in 'name'.
*/
static int
{
return (PROM_WALK_TERMINATE);
}
return (PROM_WALK_CONTINUE);
}
{
return (result);
}
/*
* Return the root nodeid.
* Calling prom_nextnode(0) returns the root nodeid.
*/
prom_rootnode(void)
{
}
{
(void) p1275_cif_handler(&ci);
}
{
#ifdef PROM_32BIT_ADDRS
return (OBP_BADNODE);
}
}
#endif
(void) p1275_cif_handler(&ci);
#ifdef PROM_32BIT_ADDRS
#endif
}
prom_chosennode(void)
{
if (chosen)
return (chosen);
if (node != OBP_BADNODE)
prom_fatal_error("prom_chosennode: Can't find </chosen>\n");
/*NOTREACHED*/
/*
* gcc doesn't recognize "NOTREACHED" and puts the warning.
* To surpress it, returning an integer value is required.
*/
return ((pnode_t)0);
}
/*
* Returns the nodeid of /aliases.
* /aliases exists in OBP >= 2.4 and in Open Firmware.
* Returns OBP_BADNODE if it doesn't exist.
*/
prom_alias_node(void)
{
if (node == 0)
return (node);
}
/*
* Returns the nodeid of /options.
* Returns OBP_BADNODE if it doesn't exist.
*/
prom_optionsnode(void)
{
if (node == 0)
return (node);
}