libdevinfo_sun4u.c revision 2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License, Version 1.0 only
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * (the "License"). You may not use this file except in compliance
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * This file contains the functions that are to be called when
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * a platform wants to use libdevinfo for it's device information
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * instead of OBP. This will allow prtdiag to support hot-plug
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * events on platforms whose OBP doesn't get updated to reflect
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * the hot-plug changes to the system.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinint do_devinfo(int syserrlog, char *pgname, int log_flag,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void dump_di_node(Prom_node *pnode, di_node_t di_node);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic Prom_node *walk_di_tree(Sys_tree *tree, Prom_node *root,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic int match_compatible_name(char *, int, char *);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Global variables
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chindi_prom_handle_t ph; /* Handle for using di_prom interface */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern char *progname;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Used instead of the walk() function when a platform wants to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * walk libdevinfo's device tree instead of walking OBP's
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * device tree.
int board_node = 0;
int *int_val;
int portid;
NULL) {
#ifdef DEBUG
if (board_node) {
if (board_node)
return (NULL);
return (pnode);
int retval = 0;
char *di_name;
void *di_data;
int di_ptype;
switch (di_ptype) {
int *int_val;
char *char_val;
case DI_PROP_TYPE_INT:
if (retval > 0) {
case DI_PROP_TYPE_STRING:
if (retval > 0) {
case DI_PROP_TYPE_BYTE:
if (retval > 0) {
case DI_PROP_TYPE_UNKNOWN:
if (retval > 0) {
case DI_PROP_TYPE_BOOLEAN:
if (retval <= 0)
for (i = 0; i < OPROM_NODE_SIZE; i++)
char *p_name;
unsigned char *p_data;
if (retval <= 0)
for (i = 0; i < OPROM_NODE_SIZE; i++)
return (retval);
int i, ret = 0;
for (i = 0; i < n_names; i++) {
return (ret);