1*1708Sstevel /* 2*1708Sstevel * CDDL HEADER START 3*1708Sstevel * 4*1708Sstevel * The contents of this file are subject to the terms of the 5*1708Sstevel * Common Development and Distribution License (the "License"). 6*1708Sstevel * You may not use this file except in compliance with the License. 7*1708Sstevel * 8*1708Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1708Sstevel * or http://www.opensolaris.org/os/licensing. 10*1708Sstevel * See the License for the specific language governing permissions 11*1708Sstevel * and limitations under the License. 12*1708Sstevel * 13*1708Sstevel * When distributing Covered Code, include this CDDL HEADER in each 14*1708Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1708Sstevel * If applicable, add the following below this CDDL HEADER, with the 16*1708Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 17*1708Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 18*1708Sstevel * 19*1708Sstevel * CDDL HEADER END 20*1708Sstevel */ 21*1708Sstevel 22*1708Sstevel /* 23*1708Sstevel * Copyright 2000 Sun Microsystems, Inc. All rights reserved. 24*1708Sstevel * Use is subject to license terms. 25*1708Sstevel */ 26*1708Sstevel 27*1708Sstevel #ifndef _SGFRUTREE_H 28*1708Sstevel #define _SGFRUTREE_H 29*1708Sstevel 30*1708Sstevel #pragma ident "%Z%%M% %I% %E% SMI" 31*1708Sstevel 32*1708Sstevel #ifdef __cplusplus 33*1708Sstevel extern "C" { 34*1708Sstevel #endif 35*1708Sstevel 36*1708Sstevel #include <sys/types.h> 37*1708Sstevel #include <sys/sgfru.h> 38*1708Sstevel 39*1708Sstevel #define ROOTPARENT 0 /* well-known node value */ 40*1708Sstevel #define MAX_NODE_CHILDREN 16 /* hint */ 41*1708Sstevel #define MAX_NODE_NAME 16 /* max name size */ 42*1708Sstevel 43*1708Sstevel /* 44*1708Sstevel * PICL classes used by serengeti sgfrutree 45*1708Sstevel */ 46*1708Sstevel #define TEMP_CLASS 0x0 /* currently unused */ 47*1708Sstevel #define FRU_CLASS 0x1 /* fru class */ 48*1708Sstevel #define LOCATION_CLASS 0x2 /* location class */ 49*1708Sstevel #define PSEUDO_FRU_CLASS 0x3 /* fru class with no seeprom */ 50*1708Sstevel 51*1708Sstevel typedef struct { 52*1708Sstevel fru_hdl_t handle; /* (container) handle */ 53*1708Sstevel char nodename[MAX_NODE_NAME]; /* picl nodename, thing name */ 54*1708Sstevel int16_t has_children; /* hint if node has children */ 55*1708Sstevel uint16_t class; /* one of the picl classes */ 56*1708Sstevel union class_info { 57*1708Sstevel struct location_info { 58*1708Sstevel int16_t slot; /* location: valid slot or -1 */ 59*1708Sstevel char label[MAX_NODE_NAME]; /* label property, place name */ 60*1708Sstevel } linfo; 61*1708Sstevel } cinfo; 62*1708Sstevel } node_t; 63*1708Sstevel 64*1708Sstevel #define location_slot cinfo.linfo.slot 65*1708Sstevel #define location_label cinfo.linfo.label 66*1708Sstevel 67*1708Sstevel typedef frup_info_t child_info_t; 68*1708Sstevel typedef frup_info_t handles_t; 69*1708Sstevel typedef frup_info_t node_info_t; 70*1708Sstevel 71*1708Sstevel /* 72*1708Sstevel * PICL FRU Hierarchy 73*1708Sstevel * 74*1708Sstevel * + frutree 75*1708Sstevel * | 76*1708Sstevel * +-- safari-node 77*1708Sstevel * | 78*1708Sstevel * +-- picl fru node, name = <name> (picl class = fru) 79*1708Sstevel * | 80*1708Sstevel * +-- picl location node, name = <name> (picl class = location) 81*1708Sstevel * | o optional property slot = <instance> 82*1708Sstevel * | 83*1708Sstevel * +-- picl location node, name = <name> (picl class = location) 84*1708Sstevel * | | o optional property slot = <instance> 85*1708Sstevel * | | 86*1708Sstevel * | +-- picl fru node, name = <name> (picl class = fru) 87*1708Sstevel * | 88*1708Sstevel * +-- picl tree sibling +-- picl tree child 89*1708Sstevel * 90*1708Sstevel * 91*1708Sstevel * Request: child_info_t, with parent fru handle and max count 92*1708Sstevel * Receive: child_info_t, with child_info_t array and actual count 93*1708Sstevel */ 94*1708Sstevel #define SGFRU_GETCHILDLIST 0x000f 95*1708Sstevel /* 96*1708Sstevel * Request: handles_t, with fru handle, max count, and preallocated buffer 97*1708Sstevel * Receive: handles_t, with handle array and actual count 98*1708Sstevel */ 99*1708Sstevel #define SGFRU_GETCHILDHANDLES 0x0010 100*1708Sstevel /* 101*1708Sstevel * Request: node_info_t, with fru handle 102*1708Sstevel * Receive: node_info_t, with node_t info for the node 103*1708Sstevel */ 104*1708Sstevel #define SGFRU_GETNODEINFO 0x0020 105*1708Sstevel 106*1708Sstevel #ifdef DEBUG 107*1708Sstevel /* 108*1708Sstevel * DESCRIPTION 109*1708Sstevel * fru_get_children() fills an array of structures representing the 110*1708Sstevel * children of a node. 111*1708Sstevel * 112*1708Sstevel * ARGUMENTS 113*1708Sstevel * 114*1708Sstevel * RETURN 115*1708Sstevel * int 116*1708Sstevel * On success, the number of node_t structures written is returned; 117*1708Sstevel * on error, -1 is returned and "errno" is set appropriately. 118*1708Sstevel * 119*1708Sstevel * ERRORS 120*1708Sstevel * ENOMEM 121*1708Sstevel * The parent FRU has more than "max_children" children. 122*1708Sstevel */ 123*1708Sstevel int fru_get_children(fru_hdl_t parent, node_t *children, int max_children); 124*1708Sstevel 125*1708Sstevel /* 126*1708Sstevel * DESCRIPTION 127*1708Sstevel * fru_get_handles() fills an array of structures representing the 128*1708Sstevel * children of a node that have FRUs. Use 0 for the top root node. 129*1708Sstevel * 130*1708Sstevel * ARGUMENTS 131*1708Sstevel * 132*1708Sstevel * RETURN 133*1708Sstevel * int 134*1708Sstevel * On success, the number of fru_hdl_t structures written is returned; 135*1708Sstevel * on error, -1 is returned and "errno" is set appropriately. 136*1708Sstevel * 137*1708Sstevel * ERRORS 138*1708Sstevel * ENOMEM 139*1708Sstevel * The parent FRU has more than "max_handles" children. 140*1708Sstevel */ 141*1708Sstevel int fru_get_handles(fru_hdl_t parent, fru_hdl_t *children, int max_handles); 142*1708Sstevel 143*1708Sstevel /* 144*1708Sstevel * DESCRIPTION 145*1708Sstevel * fru_get_node_info() gets the node_t info for a handle. 146*1708Sstevel * 147*1708Sstevel * ARGUMENTS 148*1708Sstevel * 149*1708Sstevel * RETURN 150*1708Sstevel * int 151*1708Sstevel * On success, 0 is returned as well as the node_info; 152*1708Sstevel * on error, -1 is returned and "errno" is set appropriately. 153*1708Sstevel * 154*1708Sstevel * ERRORS 155*1708Sstevel */ 156*1708Sstevel int fru_get_node_info(fru_hdl_t node_hdl, node_t *node); 157*1708Sstevel #endif /* DEBUG */ 158*1708Sstevel 159*1708Sstevel #ifdef __cplusplus 160*1708Sstevel } 161*1708Sstevel #endif 162*1708Sstevel 163*1708Sstevel #endif /* _SGFRUTREE_H */ 164