2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * This file contains the functions that are to be called when 2N/A * a platform wants to use libdevinfo for it's device information 2N/A * instead of OBP. This will allow prtdiag to support hot-plug 2N/A * events on platforms whose OBP doesn't get updated to reflect 2N/A * the hot-plug changes to the system. 2N/A * Used instead of the walk() function when a platform wants to 2N/A * walk libdevinfo's device tree instead of walking OBP's 2N/A /* allocate a node for this level */ 2N/A /* assign parent Prom_node */ 2N/A /* read properties for this node */ 2N/A * For identifying Schizo nodes we need to check if the 2N/A * compatible property contains the string 'pci108e,8001'. 2N/A * This property contains an array of strings so we need 2N/A * search all strings. 2N/A * This check is needed in case the "board node" occurs at the 2N/A * end of the sibling chain as opposed to the middle or front. 2N/A * Dump all the devinfo properties and then the obp properties for 2N/A * the specified devinfo node into the Prom_node structure. 2N/A /* clear out pointers in pnode */ 2N/A D_PRINTF(
"\n\n ------- Dumping devinfo properties for node ------\n");
2N/A * get all the devinfo properties first 2N/A /* allocate space for the property */ 2N/A * Given that we're using libdevinfo rather than OBP, 2N/A * the chances are that future accesses to di_name and 2N/A * di_data will be via temp->name.val_ptr and 2N/A * temp->value.val_ptr respectively. However, this may 2N/A * not be the case, so we have to suitably fill in 2N/A * temp->name.opp and temp->value.opp. 2N/A * di_name is char * and non-NULL if we've made it to 2N/A * here, so we can simply point 2N/A * temp->name.opp.oprom_array to temp->name.val_ptr. 2N/A * di_data could be NULL, char * or int * at this point. 2N/A * If it's non-NULL, a 1st char of '\0' indicates int *. 2N/A * We thus set temp->value.opp.oprom_node[] (although 2N/A * interest in any element other than 0 is rare, all 2N/A * elements must be set to ensure compatibility with 2N/A * OBP), and holds_array is set to 0. 2N/A * If di_data is NULL, or the 1st char is not '\0', we set 2N/A * temp->value.opp.oprom_array. If di_ptype is 2N/A * DI_PROP_TYPE_BOOLEAN, holds_array is set to 0, else it 2N/A /* everything worked so link the property list */ 2N/A * Then get all the OBP properties. 2N/A /* allocate space for the property */ 2N/A * As above, p_name is char * and non-NULL if we've made 2N/A * it to here, so we can simply point 2N/A * temp->name.opp.oprom_array to temp->name.val_ptr. 2N/A * p_data could be NULL, a character or a number at this 2N/A * point. If it's non-NULL, a 1st char of '\0' indicates a 2N/A * number, so we set temp->value.opp.oprom_node[] (again 2N/A * setting every element to ensure OBP compatibility). 2N/A * These assignments create a lint error, hence the LINTED 2N/A * If p_data is NULL, or the 1st char is not '\0', we set 2N/A * temp->value.opp.oprom_array. 2N/A /* everything worked so link the property list */ 2N/A * Used in place of do_prominfo() when a platform wants to use 2N/A * libdevinfo for getting the device tree instead of OBP. 2N/A /* set the global flags */ 2N/A /* set the the system tree fields */ 2N/A * create a snapshot of the kernel device tree 2N/A * and return a handle to it. 2N/A * create a handle to the PROM device tree. 2N/A * walk the devinfo tree and build up a list of all 2N/A * nodes and properties. 2N/A /* resolve the board types now */ 2N/A * check to see if the name shows up in the compatible array 2N/A /* parse the compatible list */